Jump to content

print when expression and text field expression


mhbashar1

Recommended Posts

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

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}

 

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

e.g.

Code:
[code]new Boolean($F{Field0815}.equals("SomeText"«»))

 

3.) a VariableExpression is an expression to calculate for example a field (e.g. the sum of Field0815)

 

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.

if the variable is reset the initial value is set again (so for each page, group or whatever resettype you choose)

 

hth

C-Box

Post edited by: CBox, at: 2008/01/11 10:13

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Well again:

 

if your PrintWhenExpression is:

 

Code:
new Boolean($F{Field0815}.equals("SomeText"«»))

 

and your Field0815 has "SomeText" as value... than the whole field is printed.

 

if your Field0815 has "OtherText" as value... than the whole field is not printed.

 

...

this question I don't understand:

How can I show my entire textfield with value on such condition.

 

Please describe a bit more in detail what you want to achieve.

 

hth

C-Box

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...