Input Controls with Custom Expressions¶
You can add custom Input Controls from the following sections on the Create Input Control page:
-
Name and Description:
-
Custom Prompt Text: This is an optional field and can be used to explain users how to use the Input Control. It can also be used to provide a customized label for the input control instead of Prompt Text. It enables you to write an expression or call custom function to change the Input Control title dynamically.
For example:
Simple label for string:
‘String’Custom label:
$Por$RA tooltip appears when you hover over the question mark icon.

-
-
Display Settings:
-
Enable/Disable Input Control > Conditional: This section enables you to control editing the value of the Input Control. Based on the condition defined, you may or may not be able to edit the value of the Input Control. When selected, the associated Custom Expression input is enabled.
A tooltip appears when you hover over the question mark icon next to the Conditional > Custom Expression input field.

-
Show/Hide Input Control > Conditional: This section determines the visibility of the Input Control. Based on the condition defined, the Input Control may be shown or hidden. When selected, the associated Custom Expression input field is enabled.
The tooltip is also displayed when you hover over the question mark icon next to the Conditional > Custom Expression input field.
-
Following are the expression formats for Custom Expression:
| Input Control Type | Expression Format |
| Single value number | IC name == value |
| Single value string | IC name == 'value' |
| Single value date | IC name == d'value' |
| Single value time | IC name == t'value' |
| Single value timestamp | IC name == ts'value' |
Supported Expressions¶
The supported expressions include:
-
Comparisons: <, >, <=, >=, ==
-
Addition, Subtraction: +, -
-
Multiplication, Division: *, /
-
Function call
-
Relative dates
Expression Formats Accepted¶
| Input Control Type | Expression Format Accepted |
Single Value (String/ Number/ Date/ Time/ DateTime) |
|
| Boolean |
|
Single Select (String/ Number/ Date/ Time/ DateTime/ Relative Date) |
|
| Multi Select |
|
Note
Relative date SEMI type is not supported for custom Input Controls.
Expressions for Title¶
Users can change titles by using expressions, calling custom functions, or utilizing keys from a resource bundle. If you choose to use resource bundle keys, you must first add the corresponding bundle on the Controls & Resources page and specify the resource bundle file name using the resourceBundle attribute within the <jasperReport> tag of the JRXML file. For example, resourceBundle = 'testbundle'.
-
'StoreId for $P{Country} '
-
‘$R{sales.key} record’
-
str(‘country.key’)
-
‘$R{country.key} some other text’
-
'$R{country.key}' == 'This is country title from bundle'
For information about Input Controls for Custom Functions, see the JasperReports Server Administrator Guide.