Use of Variable expression

By: Andréorgenroth - jettschuff
Use of Variable expression
2003-09-12 03:53
I want to print out in a text field, the birthday depended on a number. I have the number in a field. I would create a variable BIRTHDAY and in the Variable expression I would write:

if( $F{NUMMER} == 11 )
String.valueOf("02.02.1978");
else if ( $F{NUMMER} == 12 )
String.valueOf("02.02.1979");

and so on. But it seems that no 'if' condition is possible.

How con I solve this problem?

Great Thanks





By: Suresh Medavaram - sureshmedavaram
RE: Use of Variable expression
2003-09-12 04:10
probably u need to create that many number of text fields as they are if statements. Here is a clear picture:
Say u have two if conditions as u have mentioned. Then create two text fields and assign to the same field NUMBER in ur case. Now,
Use <printWhenExpression> tag of text field and in that write:
new Boolean($F{NUMBER}.intValue() == 11)
and set the static text to 02.02.1978.
Again in the second text field,
new Boolean($F{NUMBER}.intValue() == 12)
and set the static text to 02.02.1979.

Now, set the transparent property to true and place two text fields one on the other. Now, u will see only one text field depending on the condition.

Hope I am clear... all the best..
Suesh M









By: Andréorgenroth - jettschuff
RE: Use of Variable expression
2003-09-12 04:23
Thank U very much.

But I have still one question. Is there a possibility to take an image into the report via iReport (per drag and drop, not per edit the xml-File)?




By: Suresh Medavaram - sureshmedavaram
RE: Use of Variable expression
2003-09-12 04:36
Yes. In iReport user interface itself, we have image icon adjacent to the ellipse icon on the tool bar(I am using iReport 2). But sometimes, it will not store the image path in xml. The best thing is, drag and drop that icon, set the other properties, shut the iReport, open xml, give the path and save it and then reopen the file in the iReport. It perfectly works. But make sure that the path seperators should be double like reports\\image\\. Also don't forget to put the entire path in double quotes.

All the best.. Suresh




By: Andréorgenroth - jettschuff
RE: Use of Variable expression
2003-09-12 04:50
I should better open my eyes. Thank you for your patience because of my stupid question.

Have a nice weekend.

Jettschuff
ktrinad's picture
1157
Joined: Aug 9 2006 - 2:36am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback