print output to file
Chris Sellitto
sellich at guaranteedreturns.com
Wed Aug 29 06:21:41 PDT 2007
> -----Original Message-----
> From:
> filepro-list-bounces+sellich=guaranteedreturns.com at lists.celes
> tial.com
> [mailto:filepro-list-bounces+sellich=guaranteedreturns.com at lis
ts.celestial.com] On Behalf Of Kenneth Brody
> Sent: Wednesday, August 29, 2007 1:34 AM
> To: scooter6
> Cc: filepro-list at lists.celestial.com
> Subject: Re: print output to file
>
> Quoting scooter6 (Tue, 28 Aug 2007 23:05:04 -0400):
>
> > I have a report that is already written that I want to
> print to a file
> > (preferably a csv file) so I can import into Excel and do some
> > analysis on
> > -- I have tried putting "printer file "/tmp/output" in my output
> > processing
> > -- but it appears it only placed a few printer codes and the Grand
> > Total line in this file -- what am I missing on this?
>
> You say you have the PRINTER FILE command in your output
> processing. Do you have something that protects it from
> being executed for every record?
> (You only want to do this once. The @ONCE event is a good
> place for such
> things.)
>
> You can also eliminate the PRINTER FILE command entirely, and
> use the "-p"
> flag to *report to direct the output to a file.
>
> (BTW, you should check with gmail to see how to get it to use
> your real name, rather than "scooter6", on the "from" line.)
>
> --
> KenBrody at BestWeb dot net spamtrap:
> <g8ymh8uf001 at sneakemail.com>
> http://www.hvcomputer.com
> http://www.fileProPlus.com
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
While that works, doesn't he want a .CSV (comma separated value) file to
pull into Excel. Won't the "PRINTER FILE"
command just dump the report as it is (print codes and all) as a flat
file? I understand he already has an existing report,
but With a little bit more coding he could also have two options in one
report. In our facility, we give the user two
options in our select process, one to send output to print, and the
other to send to a .CSV file. Depending on which one
they select, we either execute the PRINT command, or gosub to the
routine that will generate our output lines.
we employ the EXPORT command in our output process as follows (where EC
is the variable containing path, and filename).....
Note: All dummy variables have been defined and assigned before the
calling of each subroutine.
:'*****************************************************************:'***
************* W R I T E T H E F I L E ********************:
filedet:'write to file detail records::
::gosub tofile
::out(1)=IZ;out(2)=HA;out(3)=CA;out(4)=GC;out(5)=CB;out(6)=HS;out(7)=GF;
out(8)=HV;out(9)=CD;out(10)=PF;out(11)=GP:
::out(12)=KA;out(13)=LB;out(14)=KB:
::write out:
::return:
wrtsubt:'write the subtotal records::
::gosub tofile
::ja="Total For"<@sf:
::out(1)="";out(2)=JA;out(3)=IA;out(4)=IC;out(5)=IB;out(6)="";out(7)=IF;
out(8)=IV;out(9)=ID;out(10)="";out(11)="":
::out(12)="";out(13)="";out(14)="":
::write out:
::return:
wrtgrnd:'write the grand total record::
::gosub tofile
::ja="Total All Stores":
::out(1)="";out(2)=JA;out(3)=QA;out(4)=TC;out(5)=QB;out(6)="";out(7)=QF;
out(8)=QV;out(9)=QD;out(10)="";out(11)="":
::out(12)="";out(13)="";out(14)="":
::write out:
::return:
wrthdr:'write the header record::
::gosub tofile
::ma="Acct #";mb="Pharmacy";mc="Net Credit to be Issued From
Wholesaler";md="Gross Total Credit Through Wholesaler":
::me="Credit Direct From Vendor to Store";mf="Fee %";mg="Gross Service
Fee";mh=pw<px<py;mi="Net Service Fee";mj=fq<fr<fs:
::mk="Group";ml="Division";mm="Phone";mn="City/State":
::out(1)=MA;out(2)=MB;out(3)=MC;out(4)=MD;out(5)=ME;out(6)=MF;out(7)=MG;
out(8)=MH;out(9)=MI;out(10)=MJ;out(11)=MK:
::out(12)=ML;out(13)=MM;out(14)=MN:
::write out:
::return:
tofile:'write to file::
::ec(28,allup,g)="c:"{chr("92"){"e-mails"{chr("92"){ej{".csv":
::export ascii out = (ec) r=\n F=, O=" C=":
::return:
The snippet above may not be the best way of doing it, but it works for
us. In our code, we would have 2 lines one for
the actual print command, and one to send the output to a .CSV file.
When printing a detail line, we would do something like this...
sendtofile ne "Y"
Print
Sendtofile eq "Y"
gosub filedet
This can be done one time for header information, and can be done for
each sub-total break as well. Like I mentioned
some of you may have better ways of accomplishing this task, but this
one works for us.
Hope this helps somebody.
Christopher Sellitto
VP Computer Operations
Guaranteed Returns
sellich at guaranteedreturns.com
More information about the Filepro-list
mailing list