export

Brian K. White brian at aljex.com
Thu Apr 29 16:03:34 PDT 2004


Steve Waters wrote:
> Hello,
> I am writing a export file that looks like this,
>
>   export ascii file=file.txt r=\n f=, o=" c="
>
>   file(1)=1    'part number
>   file(2)=2    'description
>
> With the result of
>
>  "1234","o-ring"
>  "3456","nail"
>
> Is there a way to get the Part Number and Description
> to lead the data like this?
>
>  "part number","description"
>  "1234","o-ring"
>  "3456","nail"
>
> Thanks for any help,
> Steve

Sure, do a gosub in @once.

Here is a contacts export for palm that demonstrates.

http://www.aljex.com/bkw/filepro/palm.html

Just comment or remove the END on line 30.

That report is run with a menu F5 batch like this:
   ----snip----
   CSV=${HOME}/contacts_${COMPANY}_palm.csv
   umask 0 ; >$CSV
   rreport phone -f palm -s hotsync -u -y NoAuto -r $CSV
   echo "Phone Database has been exported to $CSV"
   ----snip----

using an @ on the menu action line so it pauses displaying the message

and the selection set named hotsync just avoids selecting junky or duplicate
records.

You will probably want some kind of sorting in your file, but just for
others looking at this, palm and outlook sort on their own so there is no
particular reason for the output format to bother sorting. Also HOME is a
system variable set during login and COMPANY is a variable my fp
start-script or config file or both always sets.

If you want to get fancy, you can have the header use the actual field names
in filepro instead of the hard coded strings in the palm example. In the
case of the palm and outlook, the headers are specially recognized so I
don't want to use my own files names for those fields.

but you can do this:

...
then: csv(1) = 5
then: csv(2) = 1
end
@once:
...
then: csv(1) = fieldname(-,5)
then: csv(2) = fieldname(-,1)

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



More information about the Filepro-list mailing list