Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » month ago(Parameters)
month ago [message #1739682] Wed, 03 August 2016 18:37
Aaron Easton is currently offline Aaron EastonFriend
Messages: 3
Registered: August 2016
Junior Member
I have a report that i did not build. The issue that i have is how it looks at the parameter date and time when it looks back a month ago. I just need it to look at the 1st and the last day. I am not worry about the time stamp.


Here is the report parameters:

importPackage( Packages.java.text );
var sqlText = new String();
var myDF1 = new SimpleDateFormat("MM/dd/yyyy", reportContext.getLocale());
var cMonth = new String();
var cMonth2 = new String();
var cMonth3 = new String();
var cMonth6 = new String();
var cMonth8 = new String();

var nDate1 = new Date();
var nDate2 = new Date();
var nDate3 = new Date();

nDate1=BirtDateTime.addMonth(BirtDateTime.now(),-params["MonthAgo"].value);
nDate1=BirtDateTime.addDay(nDate1,1-BirtDateTime.day(nDate1));

if(params["MonthAgo"].value==0) {
nDate2=BirtDateTime.addDay(BirtDateTime.now(),1);
cMonth3=" ";
cMonth6=" AND (1=2) ";
cMonth8="CURRENT TIMESTAMP";
} else {
nDate2=BirtDateTime.addMonth(BirtDateTime.now(),2-params["MonthAgo"].value);
nDate2=BirtDateTime.addDay(nDate2,1-BirtDateTime.day(nDate2));
nDate3=BirtDateTime.addDay(nDate2,-BirtDateTime.day(nDate2));
cMonth3=" AND (READINGDATE<DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate2)+"','MM/DD/YYYY'))) ";
cMonth6=" AND (READINGDATE>=DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate2)+"','MM/DD/YYYY'))) ";
cMonth8="DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate3)+" 23:59:59','MM/DD/YYYY HH24:MI:SS'))";
};

cMonth= " (REPORTDATE>=DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate1)+"','MM/DD/YYYY'))) AND (REPORTDATE<DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate2)+"','MM/DD/YYYY'))) ";
cMonth2=" (ft.DATEFLT>=DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate1)+"','MM/DD/YYYY'))) AND (ft.DATEFLT<DATE(TIMESTAMP_FORMAT('"+myDF1.format(nDate2)+"','MM/DD/YYYY'))) ";



I need some help on getting the last month only. Thanks for any help.
  • Attachment: report.txt
    (Size: 15.80KB, Downloaded 99 times)
Previous Topic:Report Parameters
Next Topic:How to use Flatfilename as Variable?!
Goto Forum:
  


Current Time: Fri Aug 07 21:04:31 GMT 2020

Powered by FUDForum. Page generated in 0.01483 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top