cgriefer Posted February 4, 2018 Share Posted February 4, 2018 I've created a query that I'd like to be able to re-use throughout different reports. Inside the report folder, I've got the JRXML file, some input controls, and a reference to the external query. So the hierarchy looks like:- ACT (folder) - Activity Report: ACT (report folder) - activity_report (jrxml file) - consolidated_report_query (a predefined query) - start date (an input control) - end date (an input control)In spite of a good amount of googling, I can't figure out how to reference that `consolidated_report_query` in the jrxml. Any help would be _greatly_ appreciated. Link to comment Share on other sites More sharing options...
mlopez_1 Posted February 5, 2018 Share Posted February 5, 2018 What i do is to create a query repository and paste a link of the query as a resource of the Report Unit.In this way, you can reuse any type of resource if it0s defined in repository.Mariano Link to comment Share on other sites More sharing options...
cgriefer Posted February 5, 2018 Author Share Posted February 5, 2018 Hey Mariano:Thank you for the reply!I think I've got that... but what I'm trying to do is call the query after specific user input. I had plain old SQL in the jrxml (with certain $P{Params} based on user input) that ran after the user chose a few values. If I like the query as I already did, how to I tell the jrxml file not to run it until the user input is received?I assumed I'd just place some sort of variable that points to the query in the jrxml where I previously had the SQL written out. Hope that makes sense?Thanks!Charlie Link to comment Share on other sites More sharing options...
cgriefer Posted February 5, 2018 Author Share Posted February 5, 2018 - ignore - Link to comment Share on other sites More sharing options...
mlopez_1 Posted February 5, 2018 Share Posted February 5, 2018 Yes it can be done, but you must use $P!{PARAMETER_NAME}, which doesn't interpret and use it as literal.In this parameter you can set your query and put in DAtaset and query dialog.Regards,Mariano Link to comment Share on other sites More sharing options...
cgriefer Posted February 6, 2018 Author Share Posted February 6, 2018 But if I use $P!{param_name} (with the exclamation mark), the parameter is no longer properly parameterized, correct? So vulnerable to SQL injection? Link to comment Share on other sites More sharing options...
mlopez_1 Posted February 6, 2018 Share Posted February 6, 2018 Must have an input control with the same ID than parameter and then you can use it in Report Unit, even you can ask the parameter for the user.It's absolutely vulnerable to SQL injection in this wayMariano 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