How to check parameters [message #1022133] |
Thu, 21 March 2013 10:23  |
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  |
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
|
|
|
Powered by
FUDForum. Page generated in 0.01405 seconds