i want to do this $F{$P{subject}}.
i create general structure for .jrxml file. i pass query dynamically to the query tag like this,
<queryString language="SQL">
<![CDATA[$P!{Query}]]>
</queryString>
So here Field is dyanamically changes. field can be fill by parameter ?
1 Answer:
Posted on May 22, 2017 at 5:50am
Since JR 6.3.1 you could use the net.sf.jasperreports.sql.field.column.name property for each field, to map the column name dinamically. Meaning you could use a static field name in JRXML that will map a column name in your dynamic query. For instance:
<parameter name="paramId" class="java.lang.String"> <defaultValueExpression><![CDATA["emp_id"]]></defaultValueExpression> </parameter> ... <field name="id" class="java.lang.Integer"> <propertyExpression name="net.sf.jasperreports.sql.field.column.name"><![CDATA[$P{paramId}]]></propertyExpression> </field>
In the above example, whenever you will use the $F{id} expression in the JRXML file, the "emp_id" column in the sql query will be referenced, via the parameter paramId.