leniviy Posted July 14, 2010 Share Posted July 14, 2010 People often advise to use 'calculated parameters' where their default value expression refers to other parameters. But in jasperserver when I open a report and change the value of initial parameter in "report options" , the calculated param isn't changed.For example:I have report parameter 'city' of type String and corresponding input control. 'city' can be null or any string value.I created another parameter 'city_sql' , default value now is just $P{city} . I planned an expression to convert string to SQL constant and then use it as filter in my query: where ( $P!{city_sql} is null or $P!{city_sql} = table1.city )But when query runs, city_sql is alvays null.I wanted to use variables instead of parameters, but discovered that '$V{}' isn't expanded inside queries.How to workaround this? Link to comment Share on other sites More sharing options...
baggypants Posted July 14, 2010 Share Posted July 14, 2010 I've done this by creating two parameters The first one $P{COMAPANY} takes the input from the user (if any) The second one $P{COMPANY_SCRIPT} manipulates the first one e.g. Default Value Expression is ($P{COMPANY}.equals( null ) ? "" : "AND COMPANIES.CODE =" + $P{COMPANY} )Then I pass that parameter back to the Query WHERE TRANS_CARDS."CASH_LOAD" IS NOT Null$P{COMPANY_SCRIPT}Post Edited by baggypants at 07/14/2010 10:33 Link to comment Share on other sites More sharing options...
bbartholow Posted April 25, 2011 Share Posted April 25, 2011 Anyone know how to do this using domain as a source and Domain Query Link to comment Share on other sites More sharing options...
bbartholow Posted April 25, 2011 Share Posted April 25, 2011 Anyone know how to do this using domain as a source and Domain Query? Link to comment Share on other sites More sharing options...
Recommended Posts
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