java - passing empty field as parameter in jasper ireport -


the query

select * db_accessadmin.customersummary   (accountnumber = $p{accountno} or $p{accountno}='') , (ppusermobile = $p{mobileno} or $p{mobileno}='') , ( ppuserstaticid = $p{customerid} or $p{customerid} = '') , (cast(requestdate date) between (cast($p{fromdate} date)) , (cast($p{todate} date))) 

the aim generate report in jasper depending on values of parameters. when parameters 'fromdate' , 'todate' empty , query should pull out entire rows in db. how can modify query accepts null values 'fromdate' , 'todate'.

xml file

<jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="customersummary2" language="groovy" pagewidth="595" pageheight="842" columnwidth="555" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20" uuid="d23efc9c-641e-4e8a-bb9e-25673ee5c713"> <property name="ireport.zoom" value="1.610510000000001"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <parameter name="accountno" class="java.lang.string"/> <parameter name="mobileno" class="java.lang.string"/> <parameter name="customerid" class="java.lang.string"/> <parameter name="fromdate" class="java.util.date">     <defaultvalueexpression><![cdata[new date()]]></defaultvalueexpression> </parameter> <parameter name="todate" class="java.util.date">     <defaultvalueexpression><![cdata[$p{fromdate}+7]]></defaultvalueexpression> </parameter> <querystring>     <![cdata[select * db_accessadmin.customersummary (accountnumber =         $p{accountno} or $p{accountno}='')  , (ppusermobile = $p{mobileno} or $p{mobileno}='')  , ( ppuserstaticid = $p{customerid} or $p{customerid} = '')  , (cast(requestdate date) between (cast($p{fromdate} date)) , (cast($p{todate} date)))]]> </querystring> 

this issue occurs when design report in jasper ireport. once deploy in server, issue resolved. server accepts null values.


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -