Adding Column Names & Metadata to Exports
Richard Kreiss
rkreiss at verizon.net
Mon Oct 3 22:03:29 PDT 2016
The header export must have not contain spaces between words. If there is a space, only the first word will be exported.
The easiest way to correct this issue would be to place an underscore between words in the map. If not, you will have to check his in processing before exporting and make the change there.
Richard
> -----Original Message-----
> From: Filepro-list [mailto:filepro-list-
> bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of Ken Cole via
> Filepro-list
> Sent: Tuesday, October 4, 2016 12:25 AM
> To: Stanley - stanlyn.com <stanley at stanlyn.com>
> Cc: filepro-list at lists.celestial.com
> Subject: Re: Adding Column Names & Metadata to Exports
>
> Stanley
>
> Each line in the file needs a write when doing multi line headers like you wish to
> do.
>
> The headers are written to lines/rows just like the data.
>
> Ken
>
> On Tuesday, 4 October 2016, Stanley - stanlyn.com <stanley at stanlyn.com>
> wrote:
>
> > Hi Ken,
> >
> > >> for each record you are exporting, gosub exp; write data line;
> > data(1)=""; data(2)=""; etc., write data
> >
> > Why are you 1. Writing data, 2. then setting data(1)..... to "", and 3.
> > writing data again? Is that just reinitializing the values before
> > doing the next?
> >
> > I've never seen a good explanation on how export works. I said before
> > that it always looked to me that we had little control over export,
> > but seeing it work as you and Mike suggest, it looks like we do have
> > plenty control, which is good. For whatever reason, I thought the
> > export routine ran only once for the entire table, instead of each
> > record. So it looks like it operates the same as all other fp
> > processing does, by running until it hits and end then advance the
> > record pointer and do it again until eof() is hit. If this is correct, then I can
> handle it...
> >
> > Thanks,
> > Stanley
> >
> >
> > -----Original Message-----
> > From: Ken Cole [mailto:ken.m.cole at gmail.com <javascript:;>]
> > Sent: Monday, October 3, 2016 9:42 PM
> > To: Stanley - stanlyn.com <stanley at stanlyn.com <javascript:;>>
> > Subject: Re: Adding Column Names & Metadata to Exports
> >
> > Stanley,
> >
> > One gotcha with FP exports is that there can only be one export
> > command in a processing file.
> >
> > So:
> >
> > 1. Create a sub routine, let's call it doexp, that does the export
> > statement, nothing else, just the export.
> > 2. gosub doexp; write header line one data(1)=""; data(2)=""; etc.,
> > write data 3. gosub doexp; write header line two data(1)="";
> > data(2)=""; etc., write data 4. Do steps 2 and 3 above in a once only
> > sub routine as explained by Mike 5. for each record you are exporting,
> > gosub exp; write data line; data(1)=""; data(2)=""; etc., write data
> >
> > What "processing" do you want to do on the data before you do the export?
> >
> > Ken
> >
> > On Tue, Oct 4, 2016 at 10:51 AM, Stanley - stanlyn.com via
> > Filepro-list < filepro-list at lists.celestial.com <javascript:;>> wrote:
> > > Hi Mike,
> > >
> > > 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
> > >
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Filepro-list
> > > [mailto:filepro-list-bounces+stanley <javascript:;>=
> > stanlyn.com at lists.celestial.com <javascript:;>]
> > > On Behalf Of Mike Schwartz via Filepro-list
> > > Sent: Monday, October 3, 2016 10:42 AM
> > > To: filepro-list at lists.celestial.com <javascript:;>
> > > Subject: RE: Adding Column Names & Metadata to Exports
> > >
> > >> How do I add the column name & number as the first row of data in
> > >> an export so the exported file will contain meta data about itself
> > >> and be
> > > self
> > >> explanatory. I'm using filepro for unix 5.0.14.
> > >>
> > >> In particular, I'd like to create row 1 with the matching field
> > >> name &
> > > number,
> > >> row 2 will contain meta data such as table name, row count, run
> > >> time and date, and finally starting at row 3 is the exported data.
> > >> The values in
> > > row 1
> > >> needs to align with the values in the exported data.
> > >>
> > >> Stanley
> > >
> > > Setup a subroutine at the bottom of your processing table that
> > > only gets called once, but that writes the header row to the spreadsheet.
> > >
> > > You will need to use the "write" command to write the header
> > > line to the spreadsheet, then use "write" again to write the first
> > > data line, then "write" again for each subsequent data line.
> > >
> > > If you look back in the archives on this list for the work
> > > "export", you should be able to find some sample code. Otherwise I
> > > can dig up some code with a header line this afternoon and send it
> > > to
> > you.
> > >
> > > Mike Schwartz
> > >
> > >
> > >
> > >
> > > _______________________________________________
> > > Filepro-list mailing list
> > > Filepro-list at lists.celestial.com <javascript:;>
> > > Subscribe/Unsubscribe/Subscription Changes
> > > http://mailman.celestial.com/mailman/listinfo/filepro-list
> > >
> > > _______________________________________________
> > > Filepro-list mailing list
> > > Filepro-list at lists.celestial.com <javascript:;>
> > > Subscribe/Unsubscribe/Subscription Changes
> > > http://mailman.celestial.com/mailman/listinfo/filepro-list
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.celestial.com/pipermail/filepro-
> list/attachments/20161004/8d1e0b30/attachment.html>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list