2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: Barra - booleong printWhenExpression using Variable 2004-05-12 00:20 I have a text and subreport using the below tag. I initialized the variable with "new Boolean(true)". <printWhenExpression> $VuserpolicyAssociationFlag} </printWhenExpression> Yet, any object that is using this variable as their expression doesn't shows up. Does the printWhenExpression disallows use of variable ? By: Mark Engstrom - me2kme RE: printWhenExpression using Variable 2004-05-12 00:56 Maybe try a slightly different syntax to your expression. As per the following : <rectangle> <reportElement x="0" y="0" width="802" height="8" backcolor="#E5E5E5"> <printWhenExpression>new Boolean($F{_Background_}.equals("0xE5E5E5"))</printWhenExpression> </reportElement> <graphicElement stretchType="RelativeToTallestObject" pen="None"/> </rectangle> By: Barra - booleong RE: printWhenExpression using Variable 2004-05-12 01:56 Sorry for my typo in first msg. Supposed to be $V{userpolicyAssociationFlag} . Thanks Mark, for the suggestion. Ok. I just tried to use "new Boolean($V{userpolicyAssociationFlag}.equals(Boolean.TRUE))" but still the same result. Notice, i use $V (variables) not $F (fields). Also my object is in the details area. --BL By: Carlos Costa e Silva - carloscs RE: printWhenExpression using Variable 2004-05-12 07:54 The printWhenExpression expects a Boolean not a boolean. Use: new Boolean($V{userpolicyAssociationFlag}) or: Boolean.valueOf($V{userpolicyAssociationFlag}) By: Barra - booleong RE: printWhenExpression using Variable 2004-05-14 02:16 my Variavble type is Java.lang.Boolean Jasper does not allow boolean as variable. The thing is, it just doesn't take the Variable's true or false state By: Barra - booleong Bug: Variable not taken in expression 2004-05-19 02:31 I'm convinced now that printWhenExpression does not take Variable (java.lang.Boolean) properly. It results in false anyhow. Is this the right way to report a bug ? By: Tobias Gaekle - ike987 RE: Bug: Variable not taken in expression 2004-05-19 04:55 the printWhenExpression should work fine, i have used it many times (jasperreports-0.5.0). maybe you should give some more info on your problem. By: Barra - booleong RE: Bug: printWhenExpression using Variable 2004-05-20 02:39 Hi Tobias, Did you succesfully use $V (variable) in prinWhenExpression ? I'm using a $V which is of type java.lang.Boolean It works only if I'm not using $V (variables). I need to use variables because i need the scriplet to set the condition whether to display a certain set of objects. And scriplets are only allowed to set variables. I'm on jasperreports 0.5.2 . Thanks. --BL By: Mark Engstrom - me2kme RE: printWhenExpression using Variable 2004-05-20 03:06 Have tried using CDATA tags in the expression, as in the following example. I know it uses parameters but should work OK with variables. <textField isBlankWhenNull="true" > <reportElement positionType="Float" x="390" y="341" width="100" height="15" forecolor="#111111" > <printWhenExpression> <![CDATA[new Boolean($P{CAS_OUR_INST_TIME_MAN} != null && $P{CAS_OUR_INST_TIME_MAN}.trim().length() > 0 )]]></printWhenExpression> </reportElement> <textElement textAlignment="Left" lineSpacing="Single"> <font reportFont="Serif_Normal" size="11"/> </textElement> <textFieldExpression class="java.lang.String"> <![CDATA[( $P{CAS_OUR_INST_TIME_MAN} != null && $P{CAS_OUR_INST_TIME_MAN}.trim().length() > 0 ) ? ( $P{CAS_OUR_INST_TIME_MAN} + " London Time" ) :""]]></textFieldExpression> </textField> By: Barra - booleong RE: Bug: printWhenExpression using Variable 2004-05-20 04:33 Believe me, try variables. Just create a Variable the initialized as true. new Boolean(true) will do. --BL By: Teodor Danciu - teodord RE: printWhenExpression using Variable 2004-05-21 15:04 Hi, What type of calculation have you set to your variable. is it by any chance "Nothing"? "Nothing" means that the variabile, after being initialized will be set by evaluation its expression for every iteration in the data source. If it does not have any expression (only an initial value expression), then it will be set to null, which has the same effect as Boolean.FALSE when used in the printWhenExpression. If you have the scriptlet setting a custom value during filling, use calculation="System". I hope this helps. Teodor By: Barra - booleong Solved: printWhenExpression using Variable 2004-05-24 22:31 Yes Teodor! It was "nothing" . Working now that it is set to "System". Thanks for your advise. Appreaciate it a lot. --BL 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