You can either insert a new sub-report into the main report and start designing the sub-report or you can embed a pre-existing report into the main report and start modifying it.
For more information on how to design a main report, refer to Desktop Studio – Beginner’s Guide.
Inserting a New Sub-Report
On the Intellicus Desktop Studio screen, open the main report in which a new sub-report is to be inserted and designed.
- Click Insert > Sub-Reports. The cursor changes to a cross (+) symbol.
Figure 1: Inserting Sub-Report
- Click the layout pane and drag your mouse to mark an area to create a sub-report frame.
Figure 2: Edit Sub-Reports
- Right click on the sub report frame and select Edit SubReport option. The Create a new Sub-report from screen appears.
Figure 3: Creating Sub-Reports
- Select New Report radio button and click Ok. The Sub-Report Wizard screen appears on which you can open a blank report to design a sub-report or you can use the wizard to design a sub-report.
- Start designing the new sub-report by using the simple and complex controls in a similar way you designed the main report. For more information on how to design a report, refer to Desktop Studio – Beginner’s Guide.
- Click Save to save the sub-report.
- Click Close button to return to main report.
Note: A sub-report may need to use parameters of main report. If that is the case, create a new sub-report using wizard. This way you can use parameters of main report in sub-report also.
- To edit the sub report, right click on the sub-report frame and click Edit SubReport.
Figure 4: Editing Sub-Reports
- Edit the sub-report as per requirement and save the report.
Embedding a Pre-Existing Report
You can use a pre-designed report as a sub-report by embedding the report in the main report. To embed a report:
- Create a sub-report holder in a report or a sub report.
Figure 5:Editing Sub Report
- Right click on the sub-report frame and click Edit SubReport. The Create a Sub-Report from screen appears.
Figure 6: Embedding a Sub-Report
- Click Existing Report radio button.
- Click Browse from the list to select the pre-existing report from the saved location.
Figure 7: Browsing Sub Report from Existing Report
- Select the parent report from which you want to insert the sub report. The list of pre-designed reports appears.
- Select the sub report to be included and click Open. The sub report is embedded in the main report.
Note: To embed a deployed sub-report, download it from the server, save it locally and embed it in your main report.
When a sub-report is referenced, its name and category details are placed in parent report. The actual report is referred at run time.
Tip: Use referenced report when a sub-report may be used in multiple parent reports. Also, it is a good idea to use referenced report when a sub-report may undergo frequent changes.
- Create a sub report holder in a report or a sub report.
Figure 8: Referencing
- In SubReportType property, select Referenced.
- In Source property, select the report.
Note: The values in ‘CategoryName’ and ‘ReferencedReportname’ auto-appear based on the value in Source property.
Converting an embedded sub-report to referenced
When an embedded sub-report is changed to referenced, Intellicus Studio uploads that report on Intellicus server in user specified folder and marks it as referenced.
- Select the sub-report component.
- In SubReportType property, select Referenced. Click Yes on Confirm convert dialog box.
- In Upload to Server dialog box, specify category (folder) and report name.
- Click Upload. The sub-report type is changed to referenced.
Accessing Parent report’s data from sub-report
You can access parent report’s data from within the sub-report. The values of parent report’s fields are passed to sub-report as parameters in sub-report. These parameters are of the same name as field name (or alias if alias is used) in parent report. For example, value of parent report’s field “customerid” is available in sub report in the parameter named “customerid”.
When you create an embedded sub report, Intellicus automatically creates these parameters. When you use a referenced sub report, you need to make sure you have manually made those parameters in the sub report. These parameters can be used in sub report as it is, as well as in SQL as filter.
For example, SQL in the parent report: SELECT ORDERS.ORDER_NO, ORDERS.ORDER_DT FROM ORDERS
Parameters in sub-report: ORDER_NO, ORDER_DT
SQL in sub-report: SELECT ORDRDETL.ORDER_NO, ORDRDETL.PROD_NO, ORDRDETL.PRICE, ORDRDETL.QTY FROM ORDRDETL WHERE ORDRDETL.ORDER_NO = <%ORDER_NO%>
Figure 9: Report Layout of the sample report
Figure 10: A sample report preview displaying data from parent report and sub-report SQLs
Important: Before using a numeric parameter as filter in SQL, make sure default value has been set for the parameter. When a numeric parameter without a default value is used in SQL it will result in SQL Error.
If parent report has more than one fields with same name, for example, product.prod_no and invoice.prod_no, then use alias in parent report’s SQL, for example, prod.prod_no AS PprodNo and invoice.prod_no AS InvProdNo. In sub report, Intellicus will make parameter with alias – PprodNo and InvProdNo.
Using Stored Procedures with Sub Report
The method of using stored procedures in sub reports is the same as used in parent report.
Fetching Sub Report Data from Other Databases
To generate sub reports, you can either use the database connection of the parent report or use another (configured) connection. To do this, click tool-button or menu Tools > Report Properties to open Report Properties dialog box, which is resizable. On this dialog box you can specify:
- Data Connection
- Report summary
- Report Statistics
- Security Settings
Figure 11: Tick indicates that the connection status as active
The database connections mentioned here are configured connections in the report engine. These connections were defined while configuring the Intellicus Report Engine.
Note: To let the sub reports use the parent report’s database connection, you need to select for all sub reports check box from the database connection window.
Selecting the Source Connection
From the Engine tab you can define the database (connection) to be used to fetch data for the report / sub report.
You can choose from the following options available in this dialog:
- Use Engine Default: This option will use the connection, which was marked as default on Database Connections This option will appear as default selected by default when you are working with a report that is not a sub report.
- Use Named: Select this option to provide the named (configured) connection to fetch data for the report. This will override the default connection.
- Runtime Priority: Select this option to set the runtime priority for the report. For example, Low, Medium, or High.
Sub Report Summary information
From the Summary tab, you can specify report summary information:
Figure 12: Sub Report Summary Tab
- Enter the information (text) relevant to the report in this tab such as Title of the report, author of the report, version of the report, company using the report, keywords in the report, version comments, and long description of the report.
- Click OK to save the details.
Sub-Report Statistics Tab
From the Statistics tab, you can view report statistics.
Figure 13: Sub Report Statistics Tab
This is a read only screen. Click OK.
Sub-Report Template Tab
From this tab, you can select if to use alternate background color and alternate foreground (text) color in the report.
Figure 14: Color and layout mode
A report becomes easier to read if rows of report are printed in alternate colors.
Intellicus provides three report layouts: Simple for freeform fields arrangement, Tabular for list like (one line per row, with no space between fields), and Form arrangement having one field below other.