Hi,
I use in a query a parameter $P{CLSH} wich is got at execution time from a single select list Input Control.
One of the possible content of this parameter is :
substr(lib_nom_lie,1,decode(instr(lib_nom_lie,'('),0,length(lib_nom_lie)+1,instr(lib_nom_lie,'('))-1)
(that allows me to change the grouping level of the query by playing with the part of the field "lib_nom_lie" taken into account)
I use it in the query as follows :
select $P!{CLSH} .........
Till now no problem : this was working fine.
Since the 3.7.1 Jasperserver release, when I select the parameter input of the list corresponding to the value listed above, nothing happens : no error, but I remain on the parameter window. If I select another value for the parameter in the list, all is OK. If I test my query with this value outside Jasperserver on the same database (with sqldevelopper) , all is working well with the right results.
I tried to change the value by deleting the single quotes inside the parameter :
"substr(lib_nom_lie,1,decode(instr(lib_nom_lie,(),0,length(lib_nom_lie)+1,instr(lib_nom_lie,())-1)"
Of course this is crazy from sql point of view but if I click on "OK", then jasperserver launches my query and I get an "SQL execution error" that is normal according to my modification.
So, it seems that something has changed with the new release of Jasperserver in the parsing of the input parameters ( introduction of cascading input controls??).
Can anybody help me to fix this point : how to escape the single quotes in a parameter in Jasper. I tried with antislash. I tried also to put "\\Q')'\\E (found in the net). But nothing worked.
Thanks for any suggestion
Gaby
11 Answers:
More Info,
In fact, when I said it was not working when I tried to escape the single quote with a backslash, I was wrong : jasperserver launched the report but there was a SQLM execution error. When I write
\\')\\' in the input control
jasperserver accepts and launches the report but I get " \\')\\' " inside the parameter value. So I have to eliminate the backslah caracters with a ".replace("\\\\","").
I have tested and it works. So in my report I have a first parameter which maps the input control, and I have another parameter to be used in the query which has as default value the first parameter.replace("\\\\","").
It works fine.
But perhaps have you a smarter method ??
So thanks for your future suggestions.
Gaby
This has been fixed after the JS CE 3.7.0 release. See the changes in rev. 16755 at http://jasperforge.org/scm/viewvc.php/branches/js-for-pro-3.7.x/jasperserver-war/src/main/webapp/WEB-INF/jsp/DefaultParametersForm.jsp?root=jasperserver&r1=16882&view=log
You can merge the changes to your version of the file.
Regards,
Lucian
Have done that and experimented a bit more ... the three options in "Controls Layout" for each report are :
- Pop-Up Window
- Seperate Page
- Top of Page
I would normally have used "Top of Page", as I adjust and rerun reports using the web interface regularly.
Having now successfully installed the fix that was mentioned by Lucian (thanks), and also updates to
- ReportTopInputControls.jsp (2,937kb)
- ReportTopParametersForm.jsp (25,027Kb)
- FillParams.jsp (4,294Kb)
- ViewReport.jsp (8,226Kb)
- ViewReportControlsDialog.jsp (5,683Kb)
- DefaultParametersForm.jsp (22,839Kb)
After these updates, I checked with each of the methods in turn, and only the "Seperate Page" works when I have apostrophes in the parameters. "Pop up window" and "Top of Page" both don't - still!
Any ideas?