Issue Description
User created an Ad Hoc Report based on Ad Hoc View with Locked Pre-filter.
In order to display the pre-filter value in the report, he added a TextField with expression like
$P{REPORT_PARAMETERS_MAP}.get("shipcountry_1")[/code]
where shipcountry is a filed used in the pre-filter.
But the expression always returns NULL instead of value specified in the pre-filter.
Explanation
In case of creating Locked Pre-Filter, as end-user can't modify the filter value, JasperReports engine does not create a parameter for the filter.
If you check Ad Hoc View's state.xml file, the filter defined with static value, like
<subFilter id="filter_1" letter="A" objectType="String" sourceString="DATA_CHOOSER_NO_PROMPT"><expressionString>shipcountry in ('USA')</expressionString><parameterizedExpressionString>shipcountry in ('USA')</parameterizedExpressionString></subFilter>[/code]
while in case of using non-locked per-filter, a parameter is created and used in the expression like
<subFilter id="filter_1" letter="A" objectType="String" sourceString="DATA_CHOOSER_NO_PROMPT"><expressionString>shipcountry in ('USA')</expressionString><parameterizedExpressionString>shipcountry in shipcountry_1</parameterizedExpressionString></subFilter>[/code]
That's why expression like
$P{REPORT_PARAMETERS_MAP}.get("shipcountry_1")[/code]
returns NULL.
A possible workaround is to create a non-locked Pre-Filter in Ad Hoc View and then make associated Input Control invisible to not allow end-users modifying the value.
Solution tested with TIBCO JasperReports® Server v.7.2.0
AS-20191023, case #01808330
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now