Jump to content
We've recently updated our Privacy Statement, available here ×

How to print latest date (Jasper Reports with XML datasource) ??


yulia.sebrovskaya

Recommended Posts

 

I am a newbie to Jasper reports (version 4.5.1). I need help with my XMLdatasource.

This is my XML:

           

                        10.01.2013

                        11.02.2013

13.04.2013

                        12.03.2013

 

I need to print only latest date (date>13.04.2013)

Please help. Thanks.

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Hi yulia, 

You can do the following. 

1) Retrieve the date as a field (String type). From now on, the name of this field will be 'date'.

2) Create a variable (the name could be 'vardate') with the following (java.util.Date type) with the following variable expression: new SimpleDateFormat ("dd.MM.yyyy").parse($F{date})

3) Create another variable (java.util.Date type) with Calculation=Highest and Variable Expression=${vardate}, being vardate the variable created in the previous step. 

This way you'll have the latest date.

Hope this helps.

Regards,

Aitor

 
Link to comment
Share on other sites

i think you use this query, your problem might be solve.

 

select max(dat)

from

(

select to_date('26/08/2008','dd/mm/yyyy') as dat from dual

union all

select to_date('26/08/2010','dd/mm/yyyy') as dat from dual

union all

select to_date('26/03/2013','dd/mm/yyyy') as dat from dual

union all

select to_date('26/02/2013','dd/mm/yyyy') as dat from dual

union all

select to_date('26/01/2013','dd/mm/yyyy') as dat from dual

) tmp

Link to comment
Share on other sites

select max(dat)

from

(

select to_date('26/08/2008','dd/mm/yyyy') as dat from dual

union all

select to_date('26/08/2010','dd/mm/yyyy') as dat from dual

union all

select to_date('26/03/2013','dd/mm/yyyy') as dat from dual

union all

select to_date('26/02/2013','dd/mm/yyyy') as dat from dual

union all

select to_date('26/01/2013','dd/mm/yyyy') as dat from dual

) tmp

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