I have three different queries and want to run them as per value get in jasper report.Queries are written in Jrxml file itself.How I can run different queries based on different dynamic values.
Like (It is just a sudo code)
If($(a) == "Germany")
run query 1
If($(a) == "India")
run query 2
Any help would be highly appreciated.
Define parameter $P{a}
in mainReport.jrxml
Make subreports subreport1.jrxml (query1), subreport2.jrxml (query2)
Put subreport1 and subreport2 into Title band of mainReport.jrxml
Use PrintWhenExpression in mainReport for properties of subreports (Window->Properties)
Set PrintWhenExpression in mainReport for subreport1: $P{a}.equals("Germany")
Set PrintWhenExpression in mainReport for subreport2: $P{a}.equals("India")
Pass $P{a}
into mainReport from your application