header-logo.png
header-logo.png

Jasper Tech Tip – Check NULL Condition for Multi-Select Input Controls

Jasper Tech Tip – Check NULL Condition for Multi-Select Input Controls

Checking for IS NULL or IS NOT NULL for single-select input controls in jasper is straight-forward using SQL expression like below

$P{param_name} IS NULL
— Returns true if the user has not selected any value in the input control

$P{param_name} IS NOT NULL
— Returns true if the user has selected any value in the input control

The above expression will not work in the case of multi-select input controls as multi-select input controls are of the data type Collection. To check if the multi-select input controls have user selection or not the following expression can be used.

If the input control data type is number:
(select 1 from dual where $X{IN, 0, param_name })
— Returns 1 if the user has not selected any value in the input control

(select 1 from dual where $X{IN, 0, param_name })
— Returns NULL if the user has selected any value in the input control

If the input control data type is string:
(select 1 from dual where $X{IN, ‘’, param_name })
— Returns 1 if the user has not selected any value in the input control

(select 1 from dual where $X{IN, ‘’, param_name })
— Returns NULL if the user has selected any value in the input control

Author: Gayathri Gupta, PPM Architect
Contact us:
For any questions or have enquiries about our report development service offerings please contact us at info@albatrozsolutions.com or balaji@albatrozsolutions.com. We will be glad to help.