crazyzai0123 Posted October 4, 2017 Share Posted October 4, 2017 I want to print my detail band with expression based on field value but seems not working. I've tried:new.java.lang.Boolean($F{Code}.equals("COD"))new Boolean($F{Code}.equals("COD"))$F{Code}.equals("COD")$F{Code} == "COD"Any idea to make it works? Link to comment Share on other sites More sharing options...
kaushiklokesh123 Posted October 4, 2017 Share Posted October 4, 2017 Hi, Detail band will be shown for every row of your resultset of your query. If 5 out of 10 rows have Code='COD' then then it will be only shown for those 5 rowsCan you please share sample resultset and jrxml.Thanks Link to comment Share on other sites More sharing options...
Peñarandix85 Posted October 5, 2017 Share Posted October 5, 2017 Good morning,on the detail band options i have used $F{field}.equals("field"). Im displaying a table using parameters. When i select the parameter (as a filter, named "field) from the panel it prints the detail band not when i dont select any or any different.Im not sure what you specifically need but what i have displayed in detail band is a pic. Hope this helps!! Link to comment Share on other sites More sharing options...
crazyzai0123 Posted October 5, 2017 Author Share Posted October 5, 2017 OK, basically is ,my database have an ID, and Code. So in my report I select ID:1 , and the id's code comes with value "COD", so when I preview the report, I insert the ID parameter as 1, result will return me code with value "COD". Now i want when the code value is "COD", one of the detail band is hide. but i tried many printWhen expression and all the output not met my requirement <band height="60"> <printWhenExpression><![CDATA[$F{Code}.equals("COD")]]></printWhenExpression> <staticText> <reportElement x="370" y="20" width="100" height="30" uuid="dd9cb634-244f-4dd4-b329-4c90e406afba"/> <text><![CDATA[One Detail]]></text> </staticText> </band> <band height="56"> <staticText> <reportElement x="370" y="20" width="100" height="30" uuid="d4259182-215b-4b3e-9673-bcd6cb5ac355"/> <text><![CDATA[Another detail]]></text> </staticText> </band>[/code] Link to comment Share on other sites More sharing options...
Solution crazyzai0123 Posted October 5, 2017 Author Solution Share Posted October 5, 2017 I've figured out the problem. to compare the string , use ' instead if " 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