Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to check parameters
icon5.gif  How to check parameters [message #1022133] Thu, 21 March 2013 10:23 Go to next message
Blaine Mising name is currently offline Blaine Mising name
Messages: 25
Registered: December 2010
Junior Member
I've a typical report with "ini date" and "end date" parameters.

I want to put a limit in the end date paremeter, for example: if the user puts a end date > start date + 1 month shows an error message and not execute the report.

How can I do it?

[Updated on: Thu, 21 March 2013 10:24]

Report message to a moderator

Re: How to check parameters [message #1022151 is a reply to message #1022133] Thu, 21 March 2013 11:14 Go to previous message
Blaine Mising name is currently offline Blaine Mising name
Messages: 25
Registered: December 2010
Junior Member
I have it. I check if the value is valid, but I wan't to show a custom message instead "The message is: org.eclipse.birt.report.service.api.ReportServiceException: The validation for parameter "param_end_date" fails."


Here is the validation script:


importPackage(Packages.java.lang);
importPackage(Packages.java.util);
importPackage(java.text);


sdf= new SimpleDateFormat("yyyy-MM-dd");
dStart = sdf.parse(params["param_start_date"].value);
dEnd = sdf.parse(params["param_end_date"].value);

cal = Calendar.getInstance();
cal.setTime(dStart);
cal.set(Calendar.MONTH, cal.get(Calendar.MONTH)+1);
dTot = cal.getTime();

if (BirtComp.lessOrEqual(dEnd, dTot)){
true;
}
else{
false;
}



[Updated on: Thu, 21 March 2013 11:15]

Report message to a moderator

Previous Topic:Trouble linking report parameters to data set parameters.
Next Topic:create SQL-Querys dynamically
Goto Forum:
  


Current Time: Wed Oct 22 01:51:17 GMT 2014

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

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