Another export question

Richard D. Williams richard at appgrp.net
Mon Jan 17 11:14:42 PST 2005


Matthew,

Sort your output by Repcode and then another criteria you require.

If your process table do the following:

if   : cn ne 1 and cn ne ""
then:close merge

if   : cn ne 1       'if Repcode is field on'
then: cn(3,,g)=1;fn(11,,g)="repcode_"{1;x(1)="";gosub newcode

if   : x eq ""               'optional heading for each file created
then;z="Heading";gosub wrtout

if   :
then   'go ahead and form your export line. I like to put all the data 
oin a single line and hten export that var.'

i.e.   z=1{","{2{","{3{","   etc.
You could use tabs, pipes or any other separator. see the chars table.

wrtout:if   :
          then: export ascii merge = (fn) r=\n f=\r
          if   :
          then: merge(1)=z;z="";return

This should help. If you need code example, just ask.

Richard D. Williams


Matthew Williams wrote:

>This question follows up on what I had previously written last week
>about dynamically naming the export file based off a record field.
>
>What I need to do:
>I have a file with a bunch of records sitting on them, they are sorted
>by "RepCode", a simple 3 digit code.  In a single output process I
>would like to:
>
>Look at the first record and copy its "RepCode" into a variable.
>Execute the export command using that variable as the output filename
>Export any records that belong to that RepCode into the file until all
>records are exported that belong to that RepCode
>When I reach a record that has a new RepCode it jumps back to the
>beginning and copies the new RepCode into the variable, runs the
>export again with the new filename and dumps all corresponding
>records.
>
>So when the process is finished running I will have a dozen or so
>outputted delimited files (filename matching the RepCode) each with
>however many records correspond to them
>
>I think that makes sense.  I'm just not familiar with how I would
>write the loop?
>
>Then: aa(3,*,g)=3;goto export
>
>new
>If: aa ne 3
>Then: aa=3;goto export
>
>export
>Then: export invoice = /upss/(aa).txt <arguments>
>
>dump
>Then: invoice(1)=1.........
>If: aa ne 3
>Then: goto new
>Then: goto dump
>
>
>Ugly code, I know but I need to start somewhere.
>
>Any ideas on the propper way to do this?  Help would be appreciated!
>
>Thanks,
>-Matt Williams
>Hale Mfg.
>_______________________________________________
>Filepro-list mailing list
>Filepro-list at lists.celestial.com
>http://mailman.celestial.com/mailman/listinfo/filepro-list
>
>
>
>  
>



More information about the Filepro-list mailing list