Jump to content
Changes to the Jaspersoft community edition download ×

Java code injection into variable problem


vftake5

Recommended Posts

Hi,

I have to use specific date formatting in my report. No problem, created a new variable, what contains a SimpleadteFormatter, and the format comes from resource file. At firs time I did it the on subriport and it works correctly. Ok, I did same variable in my main report and it gives back 'null' as result.

The definition:

 <variable name="sdf" class="java.text.SimpleDateFormat">  <variableExpression><![CDATA[new SimpleDateFormat($R{date.format})]]></variableExpression> </variable>[/code]

And the usage:

<textFieldExpression><![CDATA[$V{sdf}.format($P{actDate})]]></textFieldExpression>[/code]

After it I changed the definition, and I wrote direcly the format string. Then it was working correctly. Then I took the value of affected resource into a textfield, and I saw the value is correct. 

And then I have no idea. It looks like, the variable evaluation hapens earlier as the resource fill. 

Do you have any idea, how can solve this problem?

Thank you!

Feri

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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