EXPORT Question
Brian K. White
brian at aljex.com
Tue Oct 12 16:45:00 PDT 2010
On 10/12/2010 7:49 PM, Art Moore wrote:
> I realize what I am asking about is filePro 101. But....
>
> I have tried using lines from Laura's Help File and am surely doing something wrong because it does not work. I am sure I am misinterpreting some very simple instructions.
>
> I have a file named 'crsfinal'. I want the data in that file to ultimately end up in an EXCEL file. My limited knowledge tells me to export the data into a comma-delimited .csv file and from there I can convert it to an EXCEL file.
>
> Assuming that is correct I have written the following line in output processing in the 'crsfinal' file.
>
> EXPORT WORD ofile="myfile"
>
> I get the following error:
>
> System Error
> on File: "myfile"
> Output Processing
> Line Number 1
> EXPORT WORD ofile = "myfile"
> ^
> Bad Function Number
>
> If anybody is listening I would be grateful for some help. THANK YOU IN ADVANCE.
>
> Art Moore
There are a few things you didn't specify which are necessary for an
export process to work.
Rather than guess all the details of what you're doing, instead here is
a basic export example from top to bottom, since it's easy.
This will export the first 3 fields of every record of "fpfile" out to a
csv file called "fpfile.csv" in .../appl/fpmerge
First go to define processing, select "fpfile", output processing, new,
"csvout"
-----top of processing-----
If:
Then: export word out="fpfile.csv"
If:
Then: out(1)=1
If:
Then: out(2)=2
If:
Then: out(3)=3
If:
Then: end
@once:
If: ' just in case...
Then: putenv "FPADDWP","OFF"
If:
Then: end
-----bottom of processing-----
Now run the export like this:
rreport fpfile -fp csvout -y NoAuto -u -a -ro
Now the likely modifications from that minimal working example:
If you want your prc.automatic to run on every record, remove "-y NoAuto"
If you need to do any other kind of processing involving updating any
filepro data along the way, remove "-ro"
If you want to specify the output file from the rreport command line in
a handy way:
add "-r /path/to/output/file.csv"
and change
Then: export word out="fpfile.csv"
to
Then: export word out=(@pm)
If you want to export all the fields instead of just the first three,
add more lines like "out(4)=4" after out(3)=3, and before the first END.
Warning: You can't write any sort of loop or dim/map an array to get
around having to explicitly write a command for each individual field.
Don't waste your time trying. The reason is an export alias can not take
an expression as an argument, only a litteral. The only way to automate
that is by having a process that actually writes a process table as it's
output and then runs it. See jhimport/jhexport for a full blown nice
interactive utility to do that for you if it's going to be a big deal.
I didn't get into unix permissions issues and how to write a robust
shell script around this report since you didn't say what your expected
context was. Will a user run this manually once in a while? Will cron
run this periodically? What needs to happen to the file after it is
generated? (who/what needs to be able to read it, when, immediately
after generation? would an immediate http download to the user be cool
or does some other entity need to get it via ftp the next day or does
someone expect to get it by email etc...) could (not will, _could_) more
than one person run this at the same time? etc etc etc...
--
bkw
More information about the Filepro-list
mailing list