HBK32 Posted October 6, 2009 Share Posted October 6, 2009 Hello,Can anyone tell me how to use BETWEEN clause in where clause of JasperServer report?e.g. there are two input(textbox) control to enter value which is NOT manadatory means its optional.Suppose user enter 10 in one textbox & 500 in second textbox then it should come as COLUMN_NAME BETWEEN 10 AND 500.If user don't enter anything then it should replace BETWEEN clause with 1=1I will greatly appreciate your response.Thanks. Link to comment Share on other sites More sharing options...
swood Posted October 7, 2009 Share Posted October 7, 2009 You can create a set of parameters that do this. <parameter name="parameter1" class="java.lang.String"/> <parameter name="parameter2" class="java.lang.String"/> <parameter name="queryExpression" class="java.lang.String"> <defaultExpression>if both parameters entered, generate "columnName between ${parameter1} and ${parameter2}elsegenerate "1=1"</defaultExpression> </parameter><queryString>...where $P!{queryExpression}</queryString> ShermanJaspersoft Link to comment Share on other sites More sharing options...
HBK32 Posted October 8, 2009 Author Share Posted October 8, 2009 swoodWrote: You can create a set of parameters that do this. <parameter name="parameter1" class="java.lang.String"/> <parameter name="parameter2" class="java.lang.String"/> <parameter name="queryExpression" class="java.lang.String"> <defaultExpression>if both parameters entered, generate "columnName between ${parameter1} and ${parameter2} else generate "1=1" </defaultExpression> </parameter> <queryString> ... where $P!{queryExpression} </queryString> Sherman Jaspersoft Hello Sherman,Thanks a lot for the response.Please correct me if understand wrong here.Let me know following right or wrong. If its wrong can you plz correct it ?<parameter name="param1" class="java.lang.String"/><parameter name="param2" class="java.lang.String"/><parameter name="queryExpression" class="java.lang.String">// following defaultExpression is for the parameter queryExpression<defaultExpression> ($P{param1} != null && $P{param}!=null) ? "Column_Name BETWEEN $P{param1} AND {param2}" : " 1 = 1 "</defaultExpression>What is the meaning of generate(i.e. generate "1=1") in your code ?I will greatly appreciate your response.Thanks. Link to comment Share on other sites More sharing options...
swood Posted October 13, 2009 Share Posted October 13, 2009 With an default expression like that, you can have a <queryString> like: select col1, col2, col3 from table where $P!{queryExpression} 1=1 is essentially saying no select. ShermanJaspersoft Link to comment Share on other sites More sharing options...
prasad23 Posted June 2, 2011 Share Posted June 2, 2011 Hi, i am new to tyhe jasper server,can anybody help me ragarding this error while saving adhoc report using domain i am getting the following errorIllegal XML character: 0x1forg.apache.xmlbeans.impl.piccolo.io.IllegalCharException: Illegal XML character: 0x1fIs there anybody help me to solve the problem,very urgent Thanks in advance. 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