Jump to content

Problem using Scriptlets in jasper reports


shravanthid

Recommended Posts

 Hello all,

This might be simple but I am just not able to understand what is going wrong.

I need to set a field name URL based on the value of the field account_id for each row in the report. The data for the report is set using JRBeanCollectionDataSource. URL field is not in this data set.

To set the URL field I need to call the scriptlet which in turn will use some other classes and set the URL field.

I am not able to figure out how to pass the account id value to the scriptlet.

Following is how I have these fields in my jrxml file.

<field name="account.actId" class="java.lang.Long"> </field>

<variable name="ImageGalleryURL" class="java.lang.String" calculation="System"> </variable>

in the detail band:

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="0" y="0" width="100" height="15"/>

<box leftPadding="10" rightPadding="10">

<leftPen lineWidth="0.5"/>

<bottomPen lineWidth="0.5"/>

</box>

<textElement/>

<textFieldExpression class="java.lang.Long"><![CDATA[$F{account.actId}]]></textFieldExpression>

</textField>

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="1405" y="0" width="100" height="15"/>

<box leftPadding="10" rightPadding="10">

<leftPen lineWidth="0.5"/>

<bottomPen lineWidth="0.5"/>

</box>

<textFieldExpression class="java.lang.String"><![CDATA[$V{ImageGalleryURL}]]></textFieldExpression>

</textField>

I am using the beforeDetailEval() in my scriptlet class. How do I pass the account.actId  value for each row to the scriptlet class?

 

Thanks

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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...