views:

1126

answers:

2

I have a JRXML file that I use to generate a report built on a massive SQL query for an Oracle database. I have entered a parameter to the report that gets filled as an Integer. However, I would also like to reference this parameter as a String at a different point in the query.

Is there a way I can convert the parameter from an Integer to a String within the organization of JasperReports or do I have to create a separate parameter to fill each time the report is generated?

A: 

Can you not cast it within your query? E.g using TO_CHAR in Oracle, or ::text in PostgreSQL or the equivalent in your database (you do not specify).

the.jxc
A: 

Solution found. I simply changed the parameter type from integer to string as it was entered. Oracle can evaluate the string as a number and (when the parameter is within single quotes) can evaluate the string as a string as long as a bang (!) is used (e.g. $P!{VARIABLE})

leadingzero