JDBC Report SQL using URL params for columns and values

Jaspersoft Community 'Read-Only' as of July 8, 2022

Transition to New TIBCO Community Just Weeks Away

You can still search, review wiki content, and review discussions in read-only mode. Please email community@tibco.com with questions or issues requiring TIBCO review or response.


So I got a Report working utilising parameters. 

Said parameters are used in the reports sql query e.g

SELECT * FROM table WHERE paramter_column = $P{url_parameter1}

Now, does anyone know if it is possible to also utilise a paramter in subsitute of a hard coded sql query column in the form of paramter_column. E.g

SELECT * FROM table WHERE $P{url_parameter1} = $P{url_parameter2}

Would make the report I am trying to make a alot more dynamic and adapatable, one template to suit multiple report types instead of having several report tamplates hard coded. So far when i try the above, the report throws an error. 

Any help appreciated. 



markwilliamson101's picture
Joined: Feb 23 2017 - 8:45am
Last seen: 5 years 3 months ago

So the accpeted answer does work, just beware trying to use it for multiple columns of diffeent data types. You many have to do parsing etc. Have to investiagte more. 

markwilliamson101 - 5 years 4 months ago

1 Answer:

Probably have to use $P!{query} format. Check the following page for details.



hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 3 weeks ago