How to make a value selected by default on a parameter on a Jaspersoft report / Advanced Reporting report for Clarity PPM?
Release: All
Component: Clarity Jaspersoft
The steps below illustrate two examples, one for a parameter that uses a static list of values, and one for a query based parameter.
The ‘Sort By’ parameter on the Project Risk Register report is an example of a parameter using static list of values. Out of the box it has ‘Created Date’ selected by default.
Below are steps to change the default to ‘Target Resolution Date’.
4. Click on Controls & Resources
5. Scroll down to Input Controls and locate the parameter, take note of the path then click Cancel
6. Expand the repository folder following this path and find the Input Control for this parameter, highlight then click Edit at the top
7. On the Edit Input Controls screen, click Next to get to the List of Values screen, take note of the path for values, then Cancel out of this screen
8. Expand the repository folder using this path, highlight and click Edit at the top:
9. Take note of the Value for the parameter value you want. Value is actually a unique ID for the lookup value, not its name. It can be different from the displayed text you may see from the report parameter drop down.
In this example, “Target Resolution Date” is displayed on the report parameter, while its Value (ID) is “TARGET_RESOLUTION”. After copying the text for ‘Value’, cancel out of here.
The example parameter ‘Sort By’ shown above uses a static list, all available values are conveniently listed here in the report repository.
If the parameter uses a query instead, the available values are not presented in a convenient list but stored in a database table as the values can change depending on the underlying query. To identify the exact table and column used for the parameter, check the Input Control.
Take a query based parameter Risk Status as an example, its Input Control is /ca_ppm/input_controls/common/riskStatusKey_1 .
2. Next find out the which table this key is selected from by reviewing the query by going to /ca_ppm/Input Controls/Queries
3. Click Edit to get to the Query definition, we see that the table used for the example parameter is DWH_LKP_RIM_STATUS
4. Finally use a SQL query tool to query the table for the column data type as well as all available values. The values can then be used when modifying the Default Value Expression in the following steps.
By saving changes locally and uploading back up to the original report, you can avoid some potential issues with corrupting main report or breaking sub reports in Jaspersoft Studio.
3. Upon saving, Jaspersoft Studio will open this local copy. Modify this local copy
3. A popup opens up showing the current default:
4. Replace the text inside the double quotes with the text previously copied from the parameter Value column, then click Finish:
5. If the parameter has multiple values set for default, like the second example parameter ‘Risk Status’, an ArrayList is used.
4. Locate the file that was previously saved and click Open, and Finish.
5. Finally, log in to Clarity to verify the change.
For the first example, Target Resolution Date is now selected by default for the Sort By parameter for the first example shown above.