Remove Embedded kCr's for Import

Jim Creak jim at jacsoft.co.nz
Wed Feb 24 01:04:56 UTC 2021


Hi Dan,

The problem with that idea is that the kCR might be giving the line break, so when you read in line by line you will be only getting part of the line

You would need to do a character count for your quote character, and if it odd then assume that your have read only part of the line and add the next line into the current one, then check for the number of quote characters again.

Thanks
Jim

JACSoft Programming Ltd. <http://www.jacsoft.co.nz/main.shtml>
> On 24/02/2021, at 1:42 pm, Dan Ridinger <dlr at futurechalk.com> wrote:
> 
> Hello Alan,
> 
> I usually read in the file line by line and write it back out. Using this snippet of code to remove things I don’t want. You could add kCr as a value to replace.
> 
> #
> # Launder Column names
> #
> Calculate L_COLUMN_VALUE as replaceall(L_COLUMN_VALUE,'"','') ## Remove double quote marks
> Calculate L_COLUMN_VALUE as replaceall(L_COLUMN_VALUE,'/','') ## Remove / causes code failure on the DO command
> Calculate L_COLUMN_VALUE as replaceall(L_COLUMN_VALUE,'-','') ## Remove - causes code failure on the DO command
> Calculate L_COLUMN_VALUE as replaceall(L_COLUMN_VALUE,'.','') ## Remove . causes code failure on the DO command
> Calculate L_COLUMN_VALUE as trim(L_COLUMN_VALUE) ## Remove leading and trailing spaces
> 
> 
> 
> Dan Ridinger
> Managing Director
> 
> 
> 
> 
> FutureChalk Software Inc.			
> 20521 92A Avenue						
> Langley, BC  V1M 1B7
> 					
> Phone No: 604.723.6837
> EMail: dlr at futurechalk.com
> www: www.futurechalk.com
> 
>> On Feb 23, 2021, at 2:52 PM, Alan Grinberg <omnis at alangrinberg.com> wrote:
>> 
>> Hello all,
>> 
>> I suspect a number of other developers have run into this problem. It seems rather generic.
>> 
>> Using Studio 8.1 on Mac and Windows
>> We are importing a csv text file into an Omnis list:
>> 
>>> Prepare for import from file {Delimited (commas)}
>>> Import Data
>> 
>> If a text field has an embedded kCr, it causes the import to create a new line in the list (i.e., a new record).
>> 
>> Is there some code that can deal with this?
>> Or an algorithm to take the entire file and do a search and replace on these internal kCr's and leave the end of record kCr's alone?
>> 
>> - Alan
>> 
>> ----------------------------------------------------
>> Alan Grinberg
>> AG Systems/ZOO-INK
>> San Francisco, CA 
>> 
>> www.zoo-ink.com <applewebdata://2B18004F-A5D7-4E81-AEE6-E2539DE016A7>
>> www.perfectfit.net
>> alan at perfectfit.net
>> ----------------------------------------------------
>> 
>> 
>> 
>> 
>> _____________________________________________________________
>> Manage your list subscriptions at http://lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 
> 
> _____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list