Jasper Parameter values -


added more info

  1. for me json datasource.
  2. we receive json hitting rest api. rest api may need few parameters pass.
  3. now parameters api needs , jasper parameters configured in jrxml. in below example reporttypelist, reporttype,dateparam, sheduledate params configured in jrxml.sheduledate filter parameter query json. reporttype , dateparam used hit api json data source.

now if observe below reporttypelist have mentioned defaultvalueexpression in trying keep set of values. need read set java , and populate these values in combobox on ui dynamically.

for parameter reporttype need default value if user have not selected ui need consider default value.

for example:

<parameter name="reporttypelist" class="java.util.list">     <defaultvalueexpression><![cdata[$p{reporttypelist}.set( "daily", "weekly",monthly" )]]></defaultvalueexpression> </parameter> <parameter name="reporttype" class="java.util.list">     <defaultvalueexpression><![cdata[$p{reporttype}.get[0]]]></defaultvalueexpression> </parameter> <parameter name="dateparam" class="java.util.date"/> <parameter name="sheduledate" class="java.util.date"/> 

when using defaultvalueexpression, need consider object, class null, need instance it!

reporttypelist - java.util.list,

$p{reporttypelist}.set( "daily", "weekly",monthly") 

null.set(""), can never work, nullpointer , set(string,string,string) not exists method on java.util.list

a correct expression be:

<parameter name="reporttypelist" class="java.util.list">     <defaultvalueexpression><![cdata[java.util.arrays.aslist(new string[]{"daily", "weekly","monthly"})]]></defaultvalueexpression> </parameter> 

reporttype - java.util.list??, should java.lang.string

$p{reporttype}.get[0], get[0] on java.util.list, not correct should .get(0) , return's java.lang.string, why use expression in defaultexpression, return string!

a correct expression be:

<parameter name="reporttype" class="java.lang.string">     <defaultvalueexpression><![cdata["daily"]]></defaultvalueexpression> </parameter> 

dateparam - java.util.date

you have no defaultexpression this, remember need new java.util.date() .... , can use constructors present in object!


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -