To create a print session for query-based reports

To create a print session that can print a query-based report, take the following steps:

  1. Define a print session
    1. Start the Sessions (ttadv2500m000) session. Make sure you select the proper development VRC as your current package VRC.
    2. Click New. The Sessions (ttadv2100s000) details session starts.
    3. Enter the module and session code and the description for the new session, and specify the following session properties:
      • Standard Script: No
      • Generate Script: No
      • Program Script: <The program script's code, consisting of package code, module code and the first 4 characters of the session code.>
      • Main Table: <Empty>
      • Session Type: Print
      • Window Type: Dialog
      • Main Session: Yes
      • Synchronized Dialog: <Empty>
      For the other fields, use the default values.
    4. Save the new session and close the Sessions (ttadv2100s000) details session.
    5. In the Sessions (ttadv2500m000) overview session, click Compile.
  2. Link a query-based report to the session
    1. In the Sessions (ttadv2500m000) session, select the new session and, on the appropriate menu, click Reports.... The Reports (ttadv3530m000) session starts.
    2. Click New. The Add Report to Session (ttadv2112s000) session starts.
    3. Enter the report group and the serial number. Select the desired report and click OK.
    4. Save the changes and close the Reports (ttadv3530m000) session.
  3. Edit the session's UI script
    1. In the Sessions (ttadv2500m000) session, select the new session and, on the appropriate menu, click Program Scripts.... The Program Scripts / Libraries (ttadv2530m000) session starts.
    2. Select the script and click Edit / View Script .... The script editor starts.
    3. Edit the script. For example:
      • Declare the variables you want to use as input fields on the session's form. Note: the variable names must be identical to the variable names you defined in the Reporting Studio.
      • Define defaults for the input fields on the form.
      See the following sample UI script.
    4. Save the script and close the editor.
    5. Compile the script and close the Program Scripts / Libraries (ttadv2530m000) session.

    Sample UI script:

    declaration:
    	extern	domain ttaad.pacc 	pack_from	fixed
    	extern	domain ttaad.pacc 	pack_to		fixed
    	extern	domain ttyeno		incl_pack	| print packages y/n
    
    |**************************** field sections ***********************************
    
    field.pacc_from:
    before.zoom:
    	ttaad120.pacc = ""
    
    when.field.changes:
    	pack_to	= pack_from
    	display("pack_to")					|#icc2.6.n
    
    field.pacc_to:
    before.zoom:
    	ttaad120.pacc = pack_from

    The sample script belongs to a session that prints the package combinations, and optionally, the corresponding package VRCs. Points of attention:

    • The pack_from and pack_to variables are used as input fields in the form, to enter the selection range. In the report design in Reporting Studio, pack_from and pack_to are mapped to parameters "1" and "2" that are used in the query's between statement ( between :1 and :2).
    • The incl_pack variable is used as an input field on the form. The value entered by the user (Yes or No) determines whether the packages are printed. In Reporting Studio, the incl_pack variable is used in a print condition. Based on the value of incl_pack, the detail that contains the package VRCs is printed or suppressed.
  4. Design the session's form
    1. In the Sessions (ttadv2500m000) session, select the new session and click Edit Form .... The Dynamic Form Editor starts.
    2. Edit the form: Add form fields for the input variables you defined in the UI script, and customize the structure of the form until it matches the requirements. See the following figure for an example.
    3. Save the form and close the editor.
    4. In the Sessions (ttadv2500m000) session, click Compile.
    Sample form