Adding Column Names & Metadata to Exports

Stanley - stanlyn.com stanley at stanlyn.com
Mon Oct 3 19:30:53 PDT 2016


Hi Mike,

>>     This looks approximately correct if you are trying to export the
first
20 fields of a file to a row in an ascii file.  Is this part functioning
correctly?

YES, been doing it this way for years...

And Yes, I now see how other processing can be done...  See my message to
Ken about a mic-conception on hoe exports work...


>> a simple export process that writes a header for you
I don't think simple will help unless its dynamic as I have about a hundred
tables to do, and I really don't want to hand define all the assignments.  I
was thinking something along the lines of getting the table's field count
and iterate thru them while calling  FIELDNAME() function and passing the
first 12 chars of its value to the header.  This routine would be generic
and be placed in all export routines with little to no changes.

I've also thought about appending the "map" file at the end of the export by

System "cat map>exportfile.txt"  

It would be a little easier to have the field definations at the top of the
file as most import wizards allows us the name our columns while looking at
the first 10 lines of data.  At that point when changing the fiekd type to
date, datetime, or int, then the top row of the export file will be
converted leaving char data as 0 or  empty for numerics and the such.

Thanks,
Stanley


-----Original Message-----
From: Mike Schwartz [mailto:mschw at athenet.net] 
Sent: Monday, October 3, 2016 9:49 PM
To: 'Stanley - stanlyn.com' <stanley at stanlyn.com>
Cc: filepro-list at lists.celestial.com
Subject: RE: Adding Column Names & Metadata to Exports

> I'm not sure if this helps, but it is not going to a spreadsheet, 
> however
the
> idea is the same.  I'm using the fp's export routine like this and do 
> not
see
> how to integrate a different stream for the metadata into the export
stream
> routine.
> 
>       │ If:
>>        Then: dim array(20):1 ; ct="1" ; f=""
>>   5  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
-
> loop   │ If: ct le "20"
>>        Then: f=f&array(ct)&"^" ; ct=ct+"1" ; goto loop │
>   6  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
-
>        │ If:
>>        Then: rr = "Birthday-"{ pp {""
>>   7  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
-
>        │ If:
>>        Then: export ascii data=(rr) r=\n │
>   8  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
-
>        │ If:
>>        Then: data(1)=f{"^"{pp
>>   9  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
-
>        │ If:
>>        Then: write data
> 
> Also related...  Is there a way to do processing on records AS they 
> are
being
> exported?  It appears that we have little control with export.
> 
> Thanks,
> Stanley

     This looks approximately correct if you are trying to export the first
20 fields of a file to a row in an ascii file.  Is this part functioning
correctly?

     And you can do any sort of processing that you want when you are doing
an export.  What sort of processing do you need to do in this table that
isn't working?

     You can write the metadata (column headers) by putting the headers into
a separate subroutine and calling that subroutine just once.  (Actually,
call the header writing routine once for EACH  ["Birthday-"{ pp] file that
you create.)

      I will see if I can find a simple export process that writes a header
for you and post it yet this evening...

Mike






More information about the Filepro-list mailing list