Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JasperReports queryString questions

843785Jul 23 2008 — edited Sep 26 2008
Hello,

I need to select some table in my query. The name of the table is given in java class that passes it to my .jrxml file to be used in my querystring.

I set parameters in javacode like this:

Map<String, String> inputParameters = new HashMap<String, String>();
...
inputParameters.put(jrxmlFieldName1,jrxmlParameter1);
inputParameters.put(jrxmlFieldName2,jrxmlParameter2);
jasperReport = JasperCompileManager.compileReport(getJRXMLName());
jasperPrint = JasperFillManager.fillReport(jasperReport,
inputParameters, connection);

I am trying to run the following query:

<parameter name="selFileVersion" class="java.lang.String" isForPrompting="true" >
<defaultValueExpression ><![CDATA["someFileVersion"]]></defaultValueExpression>
</parameter>
<parameter name="selId" class="java.lang.String" isForPrompting="true" >
<defaultValueExpression ><![CDATA["Id"]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select * from $P{selFileVersion} where Id = $P{selId} ]]>
</queryString>
<field name="Id" class="java.lang.String"/>

That querystring doesnt work. What is wrong?

Also one of the parameters must allaw report to display all values in the field and when I use

<![CDATA[select * from someFileVersion where fieldName = "fieldName" ]]> it works and displays all the data but when I set parameter fieldName in java class it gives me empty report:

<![CDATA[select * from someFileVersion where fieldName = $P{fieldName} ]]> what is incorrect?

And one more question: why cant I use query like this:
<![CDATA[select * from someFileVersion, someApplicationVersion where someId = $P{selsomeId}, someName = $P{selsomeName ]]>

Thank you in advance for soon reply!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2008
Added on Jul 23 2008
8 comments
3,016 views