2002 JI Open Discussion Posted August 19, 2006 Share Posted August 19, 2006 By: Joanne Corless - jocorless Decision making within reports - How? 2003-12-16 09:05 I have a report that queries the database using the usual "select *" expression and I want to be able to decide at runtime which field should be display in my report based on another fields value. Basically it is a simple IF statement If field1 = "THISVALUE" display field2 else if field1 = "THATVALUE" display field3 How can I achieve this functionality in the report's XML Jo Corless By: Joanne Corless - jocorless RE: Decision making within reports - How? 2003-12-17 08:52 Duh!!! Fixed it I just needed to use a textfield expression and a printWhenExpression By: Ethan Kayes - ebkayes RE: Decision making within reports - How? 2003-12-17 09:01 Would you mind sending a sample of the code you used to solve this problem. We have a similar requirement. By: Joanne Corless - jocorless RE: Decision making within reports - How? 2003-12-18 08:19 Here you go <textField pattern=""> <reportElement mode="Opaque" x="608" y="3" width="69" height="17" isPrintWhenDetailOverflows="true"> <printWhenExpression><![CDATA[new Boolean($F{FIELDDATATYPE}.equals("STRING")||$F{FIELDDATATYPE}.equals("LOOKUP"))]]></printWhenExpression> </reportElement> <textElement> <font fontName="Times-Roman" size="12" pdfFontName="Times-Roman" pdfEncoding="CP1252"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{OLDSTRINGVALUE}]]></textFieldExpression> </textField> 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