print when expression and text field expression

Can anybody pls tell me the difference between
1.print when expression and text field expression of a textfield

2.Variable expression and initial value expression of a variable

Would u pls give a little example of both.Thanx.
mhbashar1's picture
219
Joined: Dec 28 2007 - 2:23pm
Last seen: 15 years 5 months ago

6 Answers:

Well I'll try...

1.) TextExpression of a TextField is WHAT is printed... so what Field value or if you use some more complex TextExpressions you could do something like:
Code:
"captiontext: " + $F{Field0815} + " / " + $F{Field0816}</td></tr></tbody></table><br />
<br />
2.) PrintWhenExpression is an expression of ANY Element to show/print it or not (so <b>WHETER </b>a field - or better an element - is printed).<br />
if the expression returns true it will be printed otherwise it won't be printed<br />
e.g. <table align="center" border="0" cellpadding="3" cellspacing="1" width="90%"><tbody><tr><td><b>Code:</b></td></tr><tr><td><pre>new Boolean($F{Field0815}.equals("SomeText"«»))</td></tr></tbody></table><br />
<br />
3.) a VariableExpression is an expression to calculate for example a field (e.g. the sum of Field0815)<br />
<br />
4.) a intitial ValueExpression is the value that the variable get BEFORE any calculation will happen. (so the initial value for some cases the VariableExpression won't be calculated and you don't want to see null but better BigDecimal.ZERO. <br />
if the variable is reset the initial value is set again (so for each page, group or whatever resettype you choose)<br />
<br />
hth<br />
C-Box<br>Post edited by: CBox, at: 2008/01/11 10:13
C-Box's picture
20625
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 months 1 week ago
Very many thanx brother.Brother can u tell me what to write in textfield expression if I want to set/unset its border dynamically depending upon some condition,I mean suppose - $P{name}!=null then set the border of textfield.And Can I put more than one if()condition in the expression (not nested).Thnx again.
mhbashar1's picture
219
Joined: Dec 28 2007 - 2:23pm
Last seen: 15 years 5 months ago
Therefor you have to create a ConditionalStyle....

in iReport it's somewhere in menue (I'm at home now... so I guess to remember "Edit" --> "Styles"...)

Just create a Style "MyBorders" and add some conditions where you set the expression to your needs. You can add as many expressions as you want. For each condition you can set different element properties (colors/fonts/borders/whatever....)

At your textfield you just have to set that style in the properties.

it's quite simple

regards
C-Box
C-Box's picture
20625
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 months 1 week ago
mhbashar1 wrote:
2.) PrintWhenExpression is an expression of ANY Element to show/print it or not (so WHETER a field - or better an element - is printed).
if the expression returns true it will be printed otherwise it won't be printed

According to u,if I put this-
new Boolean($F{Field0815}.equals("SomeText")) in the PrintWhenExpression, does it mean that if the "SomeText" matches with $F{Field0815},only then the textfiled will be shown? IS IT SO? How can I show my entire textfield with value on such condition.
mhbashar1's picture
219
Joined: Dec 28 2007 - 2:23pm
Last seen: 15 years 5 months ago
Well again:

if your PrintWhenExpression is:

Code:
new Boolean($F{Field0815}.equals("SomeText"«»))</td></tr></tbody></table><br />
<br />
and your Field0815 has "<i>SomeText</i>" as value... than the whole field is printed.<br />
<br />
if your Field0815 has "<i>OtherText</i>" as value... than the whole field is <b>not </b>printed. <br />
<br />
...<br />
this question I don't understand:<br />
<table cellpadding="0" cellspacing="0" align="center" width="525" bgcolor="#cccccc"><tr><td>How can I show my entire textfield with value on such condition.</td></tr></table><br />
<br />
Please describe a bit more in detail what you want to achieve.<br />
<br />
hth<br />
C-Box
C-Box's picture
20625
Joined: Jul 19 2006 - 5:58pm
Last seen: 5 months 1 week ago
Brother I think u've already answered my question.By this-
How can I show my entire textfield with value on such condition.

I wanted to mean that depending on the passing text value("Sometext"),I want to show/hide my textfield.Actually I want to put a border around my textfield,then if $F{Field0815} matches "Sometext" the textfield will be shown,otherwise the textfield will not be shown.Can I do it?
mhbashar1's picture
219
Joined: Dec 28 2007 - 2:23pm
Last seen: 15 years 5 months ago
Feedback
randomness