Output processing, lookups, and system calls

Dave Burris dave at kwburris.com
Tue Aug 23 19:39:46 PDT 2005


John Esak wrote:

>>-----Original Message-----
>>From: filepro-list-bounces at lists.celestial.com
>>[mailto:filepro-list-bounces at lists.celestial.com]On Behalf Of Dave
>>Burris
>>Sent: Tuesday, August 23, 2005 6:00 PM
>>To: filepro-list at seaslug.org
>>Subject: Output processing, lookups, and system calls
>>
>>
>>Hello,
>>
>>filePro v5.0.11D4 on OpenServer 5.0.6
>>
>>I have a report that prints invoices to a file in ascii and then runs a
>>system call to convert the file to pdf format.  However, if I run a
>>lookup and getnext command prior to running the system call to create
>>the pdf file, the system call fails.  If I comment out the lookup and
>>getnext commands, the system call succeeds and the pdf is created.  Is
>>there are rule about using lookups in output processing?
>>
>>Below is the code with the lookup and getnext command.  It iterates
>>through each invoice line item and prints out the taxable items.
>>
>>Thanks,
>>Dave Burris
>>
>>taxitms:'Retrieve the taxable line items and print them::
>>::lookup items = kwb_invoice_line_item k=1 i=E -nx:
>>:not items 'No hardware or software:return:
>>::gosub taxitem:
>>:'Print the materials subtotal:gosub mater:
>>::pt="":
>>::return:
>>taxitem:'Iterate through and print the taxable items only::
>>:not items:close items; return:
>>:items(2) ne 1:close items; return:
>>:items(9) eq "N" 'Only print the taxable items:getnext items;
>>goto taxitem:
>>:'Set the variables and print:pt=items(3)&" "&items(5)&" "&items(4)&"
>>"&items(6):
>>::print:
>>:items(11) ne "" 'If shipping & handling exist, print an indented
>>line:pt=" SHIPPING "&items(11); print:
>>::getnext items; goto taxitem:
>>
>>    
>>
>
>Dave,
>I looked at your code and see nothing wrong with it. There are two "not
>items" lines when you could do this more easily with just one. Also, you do
>the subroutine without first checking to see if you have a record which
>needs the subroutine. You *do* check in the subroutine to see if items(2) ne
>1, but you could do this just below the first "not items" and have things
>read a little more clearly.  In other words, there is no reason to use the
>"taxitem" subroutine, the getnext code would accomplish what you want
>without it. However, I think this code would still work...  So, I think
>there is some other problem going on.
>
>  
>
Thanks for the advice John.  I will clean it up.

>Meaning, if this code were being done in *clerk, the PRINT would function as
>I think you expect it to work here. Otherwise, if you are running this in
>*report as you say, the PRINT might give you some strange results. I think
>what you would want to be using in this case is FORM. I don't think the
>PRINT command is meant to be used more than once in output processing.
>Could be wrong about this, maybe, but I think this is where the problem
>lies.
>
>  
>
I am running this code from *report.  The strange thing is that the 
ascii file is generated correctly every time.  The pdf file is also 
generated correctly when there are no lookup and getnext commands that 
run.  I walk through the code and watch the system command run, but no 
pdf file is created.  If I run the same command from the command line, 
the pdf is created ok, and if I re-run the report for an invoice with no 
invoice items (just time entries so the above lookup returns no invoice 
items), the pdf is created successfully.  It is like filePro fails to 
execute the command completely, but I see no error.  The system command is:

::system "/appl/fp/text2pdf"<if

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.celestial.com/pipermail/filepro-list/attachments/20050823/930c665a/attachment.html


More information about the Filepro-list mailing list