mass export of data
Brian K. White
brian at aljex.com
Sat Nov 13 16:04:00 PST 2004
JKantrowitz wrote:
> Thanks a bunch Brian. Your always there in the clutch.
>
> JK
> -----Original Message-----
> From: "Brian K. White" <brian at aljex.com>
> Date: Sat, 13 Nov 2004 15:36:50
> To:<jkantrowitz at genprotrans.com>, <filepro-list at lists.celestial.com>
> Subject: Re: mass export of data
>
> jkantrowitz at genprotrans.com wrote:
>> Need to export in csv format (so it can be imported into Excel) all
>> the data fields and a header line for each filepro database file
>> (customers, vendors, etc.). There are several hundred fields per
>> file.
>>
>> Here's what I've written, but it's not working right.
>> I know I could laboriously code each field for the header values, and
>> then repeat it for the data values, but there are several hundred
>> fields per file and I thought what I'd written would work. Just
>> don't have alot of time to figure it out, but I need the results
>> ....any ideas where I've gone wrong?
>
> Problem:
> You can't map an array to an export or an import
> and you can't use a variable in place of the import/export field
> number/index
>
> My solution, since I have the time and the familiarity with
> shell/awk/etc...:
> Write a little one-liner shell loop that spits out the tedious parts
> of the export table, then manually doctor the table up a little in
> rcabe, making the 2nd half (headings) into @once and adding a gosub
> for the export command and two calls to the gosub, one in @once, one
> in the main body.
> ex:
> n=1 ; until [ $n -gt 676 ] do ; echo "::export(${n})=${n}:" >>prc.exp
> ; done n=1 ; until [ $n -gt 676 ] do ; echo
> "::export(${n})=fieldname(-,${n}):"
>>> prc.exp ; done
Don't thank me too fast :)
I goofed and forgot to put the part that increments n in there.
So, assuming your shell is ksh (yours is for root, maybe not for other
users)
the above commands need to be this, these will definitely wrap so just be
aware this is only 2 lines that both start with n=1and you should see how to
unwrap them:
n=1 ; until [ $n -gt 676 ] do ; echo "::export(${n})=${n}:" >>prc.exp ;
n=$((n+1)) ; done
n=1 ; until [ $n -gt 676 ] do ; echo "::export(${n})=fieldname(-,${n}):" >>
prc.exp ; n=$((n+1)) ; done
in plain sh you'd have to use n=`expr $n + 1` instead of n=$((n+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