hemal.mehta-external Posted February 6, 2019 Share Posted February 6, 2019 Hi,I have 5 sql queries and I am designing a report which have one dropdown control and that dropdown contains name of those queries.Now, when user selects any one option from dropdown then accordingly that query should be set to the dataset and table should display data according to the result of that dataset.Can anyone please guide me how this can be achieved?Please note I am using Jaspersoft Studio for report development.Thanks in advance. Link to comment Share on other sites More sharing options...
asimkin Posted February 8, 2019 Share Posted February 8, 2019 Hi,first of all, I'd like to mention all the SQL queries must return identical set of fields, in your scenario.In order to achieve the requirements, you could use $P!{} syntax : https://community.jaspersoft.com/documentation/tibco-jaspersoft-studio-user-guide/v71/using-parameters-queries-0The idea is to create an additional hidden parameter which uses selected by user option from drop-down list to specify according query, likeIF($P{Parameter1}.equals("Q1"),"select orderid as id from orders",IF($P{Parameter1}.equals("Q2"),"select shipvia as id from orders","select 1 as id"))Then, the report dataset query should be like$P!{p_query}Find attached sample report that demonstrates the idea.Hope, this helps.Best regards,Andrew Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now