Print when no records selected

Richard Kreiss rkreiss at gccconsulting.net
Tue Jun 6 08:04:37 PDT 2017


The preverbal problem with reports, How do you print something when No records are selected?

I faced this problem when a client asked me to print (create a PDF) monthly member cancellation report by organization.  That was the easy part, there can be a cancellation date in a member record.  The issue was that they wanted a report printed even when there were no cancellations.

It was suggested that I handle this from @done.  I tried that.  I set a dummy field to be printed bp= "No Cancellation for" Jun 2017 (or whatever month it was.)  No report was generated.  I added a print after setting the value of bp.  The program crashed.

I needed a solution and realized that *report needed a record before it could execute a PRINT.

So, I changed the @done programming to do a system call to the highest organization code record in the system.  This organization has the code "9999" and is totally out of range of the active accounts.  There is a training organization with the code "9998".  Any select processing or report with no select processing has if:code ge "9000":END.

One thing, I am running a -v select process with a long variable called count.  This value is incremented after each SELECT.

At @done I check if this value is count  ge "1".  If it is, the routine ends.  If not, the program moves to setting up a system call command line and moves to that record using a dash lookup.

I created a form which looks like a page from the report with  "No Cancellation for"<mo, where mo(10,mmm_yy)=@td.  The only other variable that needed to be passed was the actual organization code. Once the form runs, a lookup is done to print its name at the top of the form.  The value of mo is set also,

Since I could not be sure what the record # for 9999, I do an index lookup to get the record #.  Then I execute an - lookup to move to that record. Keep in mind that when using a - lookup to move to a specific record, auto processing runs and any dummy fields or long variables will lose their values unless they are (NN,edit,g) global.  If not you will have to reset the values.  If any value comes from the orginal record, set a dummy field or long variable to global so it doesn't lose it value.

To run the form, I used the following command line:

Where rn is the record # to use
Where pw is the organization code
Rdate(8,yymd) - current date file created - different name from the previous cancel report.

W:\appl\fp\rreport l_marketing -f NOCancel_PDF -sr rn -rw pw -p PDF:d:\temp\pw{"_cancel_"{RDate{".pdf"

So, if you need to print a "report" page for an output when no records are selected, do a system call to another output and pass the information necessary using the -r options.  Then complete the processing when the form runs based on the values passed.

In actuality the command line is set up using long variables to hold the values.  The issue is that this output can be run from a number of locations where the drive letter and therefore the location of the various folder(directories) may be different.  Also, the whole routine may be run as a task with no human intervention.  That is handled by the -v select process, It check to see if @pm has a value.  If not, the output runs for all member organizations.  If run from a menu, a menu runs with 2 options, one organization or all organizations.  After that everything is the same.

There are probably other methods for solving this problem but this is the one that came to mind early this morning - just after mid-night.


Richard Kreiss
GCC Consulting


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 17023 bytes
Desc: not available
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20170606/9ec55fbe/attachment.bin>


More information about the Filepro-list mailing list