jani99harsh Posted May 19, 2017 Share Posted May 19, 2017 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 ? Link to comment Share on other sites More sharing options...
shertage Posted May 22, 2017 Share Posted May 22, 2017 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>[/code]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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now