We are building a report configuration screen. It would be great if we could get the parameters for a given report so that we can dynamically populate the inputs that are available and required.
We have found the solution for our issue , We just combined two tables from internal database and created a table with report id and parameters . Created a report with parameter report_id in the RS using that combined table and executed via url. Thus we got the result by executing the below url:-
parameters can only have the following types: “text”, “date”, “datasource”, “file selection”, “script” and “user variable”. You can see these when you open the report configuration → parameters, and click on the arrow next to “Parameters”.
When you add a new parameter, it is inserted into the table “rs_parameter_definition”, you can see its id in the column “entity_id”. In order to identify the parameter type, you can query the following tables and look for the id:
rs_text_param_def
rs_datetime_param_def
rs_datasource_param_def
rs_filesel_param_def
rs_script_param_def
rs_uservar_param_def
So you can use your previously created internal database query and modify it to include the param types.
Thanks for you answer , but is there any way so that we could get the types such as integer, etc , since we can’t validate with these types . If a user puts some string, but it’s supposed to be a integer, the report would fail, and it will become a mess.
My idea was to start using JRXML reports since they are readable (XML), and we can extract data types, and if the field name in the JRXML matches the Parameter Name, even if we have to build some kind of lookup table to map them, then we can know how to do proper validation in our frontend.
For example: Fieldname could be like SqFtArea or something, and we want to show the user “Area in Square Feet”
We are doing as I suggested. We had to write a cron that dumps the internal database to one that is accessible to our code, hourly. Then, when a report is selected on our report configuration screen, we are trying to build the inputs by parsing the JRXML for the field captions and the data types, so that we can populate the appropriate controls. We are open to suggestion on whether there is any easier way to construct our own report configuration screen.
It does seem like if there were a proper integer data type, it might make life easier.