Jump to content

How to pass parameter value in the field value ?


jani99harsh

Recommended Posts

 

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...