Conditional Statements in Jasper Reports

By: Muralidhar bp - pmurli
Conditional Statements in Jasper Reports
2003-01-17 03:42
Hello,

I have to use conditional statements in XML query, for example

IF (CONDITION)
query 1

ELSE
query 2

Please help me

Thanx
Murli




By: Chuck Deal - cdeal
RE: Conditional Statements in Jasper Reports
2003-01-17 05:27
If your number of choices are small you can use the tertiary format

(expression ? true-part : false-part)

For more extensive conditionals, you might want to look at scriptlets.




By: Teodor Danciu - teodord
RE: Conditional Statements in Jasper Reports
2003-01-17 05:44

Hi,

You can supply the entire SQL query at runtime
using a parameter like this:

<queryString>$P!{MyDynamicQuery}</queryString>

Then, the question is: where you make the IF test
and choose the right query
(the right MyDynamicQuery parameter value).
You could do this outside JasperReports, before
even passing the parameters to the engine.
But if there are only two possible queries, you
could use the <defaultValueExpression> of the
query parameter based on other parameters that
you actually supply.

Unlimited variations of this scenario are possible.

I hope this helps.
Teodor
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness