| 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: Step 1. Define a print session Start the Sessions (ttadv2500m000) session. Make sure you select the proper development VRC as your current package VRC. Click New. The Sessions (ttadv2100s000) details session starts. 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. Save the new session and close the Sessions (ttadv2100s000) details session. In the Sessions (ttadv2500m000) overview session, click Compile. Step 2. Link a query-based report to the session In the Sessions (ttadv2500m000) session, select the new session and, on the Specific menu, click Reports.... The Reports (ttadv3530m000) session starts. Click New. The Add Report to Session (ttadv2112s000) session starts. Enter the report group and the serial number. Select the desired report and click OK. Save the changes and close the Reports (ttadv3530m000) session. Step 3. Edit the session's UI script In the Sessions (ttadv2500m000) session, select the new session and, on the Specific menu, click Program Scripts.... The Program Scripts / Libraries (ttadv2530m000) session starts. Select the script and click Edit / View Script .... The script editor starts. 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. Save the script and close the editor. 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. Step 4. Design the session's form In the Sessions (ttadv2500m000) session, select the new session and click Edit Form .... The Dynamic Form Editor starts. 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. Save the form and close the editor. In the Sessions (ttadv2500m000) session, click Compile. Sample form Related topics To run query-based reports To create query-based reports Query-based Reporting |