Use condtionnal filter on query to choose a table

Hello guys,

I have to MSSQL databases and I want to use query A or query B to select the good one.

I used a parameter in the query :

Select orderDate, totalSales FROM $P{Database}

And I ran into this error : 

the variable of type "@P0"  must be declared

Do you have any clue in order to solve this error ?

iggythedog91's picture
Joined: Sep 20 2019 - 2:08am
Last seen: 3 years 3 months ago

1 Answer:

Hello Iggy,

Your query should work if you use $P!{Database}, this syntax is mandatory.

old question : https://community.jaspersoft.com/questions/1115771/how-set-sql-query-dataset-dynamically

arnaudsimon091's picture
Joined: Nov 26 2018 - 12:25pm
Last seen: 3 months 2 weeks ago
Feedback
randomness