Jump to content
We've recently updated our Privacy Statement, available here ×

Conditional Statements in Jasper Reports


Recommended Posts

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

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...