Lesson 9: Creating a Parameter-Based Report
In Lesson 1 of this track we created a page report that contains an order list report tab to show order lists of every month from 2015 to 2016. Now, the sales manager is asking for this same report but with different orders during a specified time. Instead of building a new report about orders in each order date, we will save the page report as a new one and then modify the dataset used by its report to meet the requirements.
Follow the tasks below to finish creating the report:
- Task 1: Create the Parameters
- Task 2: Modify the Report Dataset to Use Parameters
- Task 3: Preview and Test the Report
Task 1: Create the Parameters
- In Logi Report Designer select File > Open to open the report OrderListbyDate.cls created in Lesson 1 in the JinfonetGourmetJava.cat catalog file.
- Select File > Save As to save the report as OrderListbyDate_Parameter.cls. Then we begin to modify this report instead of the former one.
- In the Data panel, select the <New Parameter...> item in the Parameters node.
- In the New Parameter dialog box, type pStartDate in the Name field, keep the default Value Setting, select DateTime from the Value Type drop-down list, select to add a value row in the Value List box and type May 1, 2016, 8:00:00 AM as the prompting value, and then type Please input start date: as the prompting text. Select OK to create the parameter.
- Repeat steps 3 to 4 to create another parameter with the following values:
- Parameter Name: pEndDate
- Value Setting: Type-in Parameter
- Value Type: DateTime
- Prompting Values: June 1, 2016, 8:00:00 AM
- Prompting Text: Please input end date:
Task 2: Modify the Report Dataset to Use Parameters
In this task, we will apply the parameters created above to filter the dataset which is used by the report. Then when we view the report, we can specify different parameter values to dynamically filter the report to get data in the desired time period.
- On the Data panel toolbar, select the Dataset Filter button.
- In the Dataset Filter dialog box, select the Add Condition button to add a filter line, select ORDER DATE from the field drop-down list, set >= as the operator, then select .
- In the Expressions dialog box, double-click the pStartDate parameter to use it as value of the filter condition.
Then close the Expressions dialog box.
- Select Add Condition button to add another filter line. The relationship between the two filters will be And.
- Specify condition of the newly added filter as follows:
- Select OK in the dialog box to apply the settings.
Parameters can also be used to filter queries to limit their data. However, in this task, we cannot set the filter on the report's query. If we do that, all datasets based on the query will be affected, that is to say, the filter will also be applied to the report created in Lesson 1.
Task 3: Preview and Test the Report
After the steps above, readers of this report can specify any date to get orders with the time they need by specifying the parameter values dynamically.
- Save the report and select the View tab to preview the report.
Logi Report recognizes that the query is based on the value of two parameters, and therefore prompts for them as follows:
- Specify the start date and end date as required in the combo boxes or select the calendar icon to select the date.
- Select the Default button to generate the report output based on the default values for the parameters. The report is displayed as follows, showing information for orders from May 1, 2016 8:00:00 AM to June 1, 2016 8:00:00 AM only:
Tip: If the report does not look correct, you can compare it to the final version of the report provided by Logi Report. To do so, you will need to save and close this catalog and then open the JinfonetGourmetJava.cat catalog file located at
Please sign in to leave a comment.