iForms Multiple Overlay Example Overview

This iForms template is an example of a spool file where each page of the form document can have a different overlay (subreport) based on a value found within the report. This example checks for values in the $F{BillTo} field and determines which overlay to use for the selected page. 

Download Link

To download the iForms sample multiple invoice overlay:
  1. Download Invoicemultioverlay.exe
  2. Unzip to C:\RJSIFORMS.
  3. Copy all of the files to the /RJSIFORMS folder on your iSeries.

List of iForms Template files

  • invoicemultimain.jrxml
  • invoicemultimain.jasper
  • invoicemultimain.rjsxml
  • invoicemultisubreport1.jrxml
  • invoicemultisubreport1.jasper
  • invoicemultisubreport2.jrxml
  • invoicemultisubreport2.jasper
  • invoicemultisubreport3.jrxml
  • invoicemultisubreport3.jasper
  • invoicemultisubreport4.jrxml
  • invoicemultisubreport4.jasper
  • invoicemultimainScriptlet.java
  • invoicemultimainScriptlet.class

How the Example Works

You will run a main form, named invoicemultimain.jrxml, with the SPLIFORM command.
This form reads each page of the spool-file work file created with SPLIFORM and then calls a Java Scriptlet function - named getSubReport(stringvalue) and located in invoicemultimainScriptlet.java -  to determine which subreport to use for each page, based on the information in the $F{BILLTO} field. Then it calls the appropriate subreport based on the result of the getSubReport call. Each subreport prints the current page from the extracted spool file.  
Note: If you make changes to invoicemultimainScriptlet.java, you must manually compile them before running the iSeries command line:
  1. To set your Java classpath for iForms, run the SPLIFORM command once on any form.
  2. Type STRQSH and press Enter
  3. Type cd /rjsiforms and press Enter
  4. To recompile the scriptlet, type javac  invoicemultimainScriptlet.java and press Enter
  5. To see if the class was recompiled, type ls /rjsiforms/invoicemultimainScriptlet.class.
There are 4 sample subreports that each print the data for the current page number that are passed from invoicemultimain.jrxml. These subreports are named invoicemultisubreport1.jrxml through invoicemultisubreport4.jrxml.
In this example, each subreport is exactly the same, and the query for each subreport takes the REPORTSQL parameter and the PAGENUMBER field value for the current page from invoicemultimain.jrxml. The only difference between the 4 subreports is that the word INVOICE changes color. In real practice, each subreport can have very different processing, if needed.

Running the Example

  2. Choose option 50.
  3. Then choose 20. Generate Sample INVOICE spool file in RJSIFORMS output queue.
  4. Run the following command to generate the sample PDF file:


    When you view /rjsiforms/invoicemulti.pdf, the word INVOICE should be red on pages 1-2, blue on pages 3-4, and green on page 5. If cyan displays, that means the default overlay was chosen for some reason.

Still have questions? We can help. Submit a case to technical support

Last Modified On:
You don't have the appropriate permissions.
No, open a new Support Case