How to set Jaspersoft report parameter defaults

book

Article ID: 37374

calendar_today

Updated On:

Products

CLARITY PPM FOR ITG CLARITY PPM FEDERAL Clarity PPM On Premise

Issue/Introduction



How to make a value selected by default on a parameter on a Jaspersoft report

 

Environment

Release: ESPCLA99000-14.3-Clarity-Extended Support Plus
Component:

Resolution

Resolution:

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’.

Step 1: Locate the ID for available values 

1. Log in to CA PPM and navigate to Advanced Reporting > View > Report Repository, expand the folder and locate the report. Click on the space before the report name to highlight it, then click Edit.


 

2. Click on Controls & Resources:



p3.jpg 

3. Scroll down to Input Controls and locate the parameter, take note of the path then click Cancel



 

4. Expand the repository folder following this path and find the Input Control for this parameter, highlight then click Edit at the top



 

5. 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



 

6. Expand the repository folder using this path, highlight and click Edit at the top:




p7.jpg   

7. 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

1. Use this path to locate the key and review the Value Column which indicates the table column name. 



 

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.

 

Step 2: Save a local copy of the report before making any change

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.

1. Launch Jaspersoft Studio Pro, locate the report. 

2. Right click on the main jrxml and select Download to File, and proceed to save it locally to your workspace. Avoid spaces in report name.

 



p13.jpg   

3. Upon saving, Jaspersoft Studio will open this local copy. Modify this local copy




    

Step 3: Modify the parameter default value in the local report

Expand the Parameters list and highlight the parameter, the properties of the parameter is populated on the Properties tab on the right. Notice that the current default value is ‘Created Date’. Click on the pencil icon for Default Value Expression




p15.jpg   

A popup opens up showing the current default:




p16.jpg 

Replace the text inside the double quotes with the text previously copied from the parameter Value column, then click Finish:



 

If the parameter has multiple values set for default, like the second example parameter ‘Risk Status’, an ArrayList is used. 



 

•Refer to community.jaspersoft.com for further information on building expressions.

Step 4: Save the change and upload the local copy back to the server

Save the local report without publishing to the server. Right click on the report’s main jrxml again, select Properties. The Edit Resource popup opens, click on the drop down for Upload\Download Resource, then select Upload from File System



  

Locate the file that was previously saved and click Open, and Finish.



    

Finally, log in to CA PPM 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.

    


Attachments

1558694755071000037374_sktwi1f5rjvs16hvw.jpeg get_app
1558694753169000037374_sktwi1f5rjvs16hvv.jpeg get_app
1558694751281000037374_sktwi1f5rjvs16hvu.jpeg get_app
1558694749513000037374_sktwi1f5rjvs16hvt.jpeg get_app
1558694747838000037374_sktwi1f5rjvs16hvs.jpeg get_app
1558694745788000037374_sktwi1f5rjvs16hvr.jpeg get_app
1558694743886000037374_sktwi1f5rjvs16hvq.jpeg get_app
1558694741778000037374_sktwi1f5rjvs16hvp.jpeg get_app
1558694739908000037374_sktwi1f5rjvs16hvo.jpeg get_app
1558694737992000037374_sktwi1f5rjvs16hvn.jpeg get_app
1558694736188000037374_sktwi1f5rjvs16hvm.jpeg get_app
1558694734093000037374_sktwi1f5rjvs16hvl.jpeg get_app
1558694732328000037374_sktwi1f5rjvs16hvk.jpeg get_app
1558694730339000037374_sktwi1f5rjvs16hvj.jpeg get_app
1558694728613000037374_sktwi1f5rjvs16hvi.jpeg get_app
1558694726705000037374_sktwi1f5rjvs16hvh.jpeg get_app
1558694724912000037374_sktwi1f5rjvs16hvg.jpeg get_app
1558694723127000037374_sktwi1f5rjvs16hvf.jpeg get_app
1558694721325000037374_sktwi1f5rjvs16hve.jpeg get_app
1558694719579000037374_sktwi1f5rjvs16hvd.jpeg get_app
1558694717856000037374_sktwi1f5rjvs16hvc.png get_app
1558694716101000037374_sktwi1f5rjvs16hvb.jpeg get_app
1558694714211000037374_sktwi1f5rjvs16hva.jpeg get_app
1558694712260000037374_sktwi1f5rjvs16hv9.jpeg get_app
1558694710586000037374_sktwi1f5rjvs16hv8.jpeg get_app
1558694708809000037374_sktwi1f5rjvs16hv7.jpeg get_app
1558694706958000037374_sktwi1f5rjvs16hv6.jpeg get_app
1558694705032000037374_sktwi1f5rjvs16hv5.jpeg get_app
1558694703253000037374_sktwi1f5rjvs16hv4.jpeg get_app
1558694701501000037374_sktwi1f5rjvs16hv3.jpeg get_app
1558694699764000037374_sktwi1f5rjvs16hv2.jpeg get_app
1558694697973000037374_sktwi1f5rjvs16hv1.jpeg get_app
1558694696104000037374_sktwi1f5rjvs16hv0.jpeg get_app
1558694694289000037374_sktwi1f5rjvs16huz.jpeg get_app
1558694692630000037374_sktwi1f5rjvs16huy.jpeg get_app
1558694690784000037374_sktwi1f5rjvs16hux.jpeg get_app
1558694688958000037374_sktwi1f5rjvs16huw.jpeg get_app
1558694687089000037374_sktwi1f5rjvs16huv.jpeg get_app
1558694685178000037374_sktwi1f5rjvs16huu.jpeg get_app
1558694683452000037374_sktwi1f5rjvs16hut.jpeg get_app
1558694681586000037374_sktwi1f5rjvs16hus.jpeg get_app
1558694679730000037374_sktwi1f5rjvs16hur.png get_app