yulia.sebrovskaya Posted February 7, 2013 Share Posted February 7, 2013 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.201313.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 More sharing options...
yulia.sebrovskaya Posted February 7, 2013 Author Share Posted February 7, 2013 Sorry. my xml: Link to comment Share on other sites More sharing options...
sanbez Posted February 7, 2013 Share Posted February 7, 2013 The simplest solution. Set order in iReport by date descending. And set PrintWhenExpression: $V{REPORT_COUNT} == 1 on this field (field must by type java.util.Date for expamle. Not String!)But "simplest" != "best" :) Link to comment Share on other sites More sharing options...
yulia.sebrovskaya Posted February 7, 2013 Author Share Posted February 7, 2013 thanks.But I do not know what will be the structure in xml(((If I set PrintWhenExpression: $V{REPORT_COUNT} == 1, I see the first date ( 10.01.2013) but I need to print only latest date (13.04.2013) Link to comment Share on other sites More sharing options...
sanbez Posted February 7, 2013 Share Posted February 7, 2013 Are you set in iReport order by descending? In this case lastest dete will be first. Link to comment Share on other sites More sharing options...
augarte Posted February 7, 2013 Share Posted February 7, 2013 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 More sharing options...
tusar.ranjan.pradhan Posted February 13, 2013 Share Posted February 13, 2013 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 More sharing options...
tusar.ranjan.pradhan Posted February 13, 2013 Share Posted February 13, 2013 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 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