mass export of data
JKantrowitz
jkantrowitz at genprotrans.com
Sat Nov 13 15:26:01 PST 2004
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
Your answer, since you don't have the time:
Get JHExport/JHImport from this fellow list reader:
Jeff Harrison
jeffaharrison at yahoo.com
Brian K. White -- brian at aljex.com -- http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx Linux SCO Prosper/FACTS AutoCAD #callahans Satriani
>
> Thanks in advance with any help you can offer.
>
> Jay Kantrowitz
> Systems Administrator
> Genpro Inc.
> jkantrowitz at genprotrans.com
> Phone: 973-589-8200 ext. 540
> Fax: 973-589-1810
>
> ---------------------------------- process table starts
> here ------------------------------------------------------------
> IF
> THEN::f(4,.0); d(4,.0)
> IF:fx eq ""
> THEN:gosub fpfiles
> IF
> THEN:goto fields
> IF
> THEN:end
>
> fpfiles:' ******************************************************::
> IF:@qu eq "" ''wq eq ""
> THEN:co="HQ":
> IF:@qu eq "GI" ''wq eq "gi"
> THEN:co="GI":
> IF:@qu eq "MB" ''wq eq "mb"
> THEN:co="MB":
> IF:
> THEN:putenv "COMPANY",co:
> IF:
> THEN:fx(50,,g)="/pix/exports/csvexp/"{co{"_"{@fi{".csv"
> IF:
> THEN:system ">" <fx {""; system "chmod 666" <fx
> IF:
> THEN:gosub put
> IF:
> THEN:f="1"
>
> templup:
> IF:f gt numfield(-)
> THEN:return
> IF:
> THEN:jay(""{f{"")=fieldname(-,f)
> IF:
> THEN:f=f + "1"; goto templup
>
> fields:
> IF:
> THEN:gosub put
> IF:
> THEN:dim data(999):1
> IF:
> THEN:d="1"
>
> datalup:
> IF:d gt numfield(-)
> THEN:end
> IF:
> THEN:jay(""{d{"")=data[d]
> IF:
> THEN:d=d + "1"; goto datalup
>
> put:
> IF:
> THEN:export word jay=(fx)
> IF:
> THEN:return
>
> @done:
> IF:
> THEN:close jay; write; end
>
> ----------------------------------------------- end of process table
> here --------------------------------------------------
>
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
Jay Kantrowitz
Systems Administrator
Genpro Inc.
jkantrowitz at genprotrans.com
Phone: 973-589-8200 ext. 540
Fax: 973-589-1877
Mobile: 973-261-2865
More information about the Filepro-list
mailing list