Export line feed

Brian K. White brian at aljex.com
Tue Oct 17 19:40:46 PDT 2006


----- Original Message ----- 
From: "George" <gclute at comcast.net>
To: <filepro-list at lists.celestial.com>
Sent: Tuesday, October 17, 2006 9:42 PM
Subject: Export line feed


>I thought I understood the syntax on adding a line feed from some previous
> posts, however I'm having a problem getting each record processed to add a
> line feed CHR("10") to the last field. Note the last field is & with a
> chr("10"), but the exported file does not reflect spaces between lines.
>
> What am I missing here?
>
> ::fn="/u/tmp/foo/"{"U"{@tm:
> :'Export ASCII, comma delimited; 1 line/record:export ascii exp=(fn) r=\n
> f=, -x:
> :'start with first field =barcode:exp(1)=1:
> :'Day of the week served mtwhfsu:exp(2)=25:
> :'Route number:oa=mid(2,"3","2"); exp(3)=oa:
> :'Stop Sequence:exp(4)=26:
> :'account number  sending 8 character account number:exp(5)=2:
> :'type of garment from item number:exp(6)=4:
> :'Identity or wearer of garment name:exp(7)=3:
> :'Final routing/destination.:exp(8)="":
> :'27 ne ""          'auto routing code:exp(9)=27:
> :'27 eq "":'exp(9)="A":
> :28 ne "Y" 'Posting record to Softrol routing machine.:28="Y":
> :28 eq "":28="," & chr("10"):
> :28 ne "":28=28 & chr("10"):
> ::end:

maybe:
> :28 ne "Y" 'Posting record to Softrol routing machine.:28="Y":
> :28 eq "":28="," & chr("10"):
> :28 ne "":28=28 & chr("10"):

change to:
> :28 ne "Y" 'Posting record to Softrol routing machine.:28="Y":
> :28 eq "":exp(10)="," & chr("10"):
> :28 ne "":exp(10)=28 & chr("10"):

I guess you're just sort of lucky  that you don't need quotes around the 
fields and so if you add a linefeed to the last field, it comes out ok (if 
this turns out to fix it that is) even though really you've added data to 
the field itself, it would have been inside a set of quotes for instance. 
When really, this is something that should be outside the field.

Even though this probably works, and even though any other way is probably 
more code to get the same result,
I think I'd try putting the export in a gosub, and add a gosub that clears 
the exp() fields, and call the export gosub an extra time.
I think fp will only write field delimiters up to the lest field with data, 
so if no fields have data you get no delimiters. whether you get a linefeed 
I don't know.
If it works, then this way I'm more clearly and obviously asking filepro to 
write an empty record instead of doing some trick that results in an empty 
record if the planets are aligned right. It's simpler when you need to add 
more or re-arrange export fields later, and wouldn't break if you ran it of 
a different platform where a single linefeed was not a line-ending.
The difference in this case is purely conceptual but the more transparent 
your code is the easier it is to make it work and keep it working and react 
to outside changes later.

If it needs to be every single record then I'd try something easier and more 
obvious than any of this, r=\n\n  and if that didn't work I'd ask why not 
and then go back to one of the above approaches and complain while doing it.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!


>
>
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.408 / Virus Database: 268.13.4/480 - Release Date: 10/17/2006
>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
> 



More information about the Filepro-list mailing list