Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Need Help on showing custom error message in BIRT report(Need Help on showing custom error message in BIRT report)
Need Help on showing custom error message in BIRT report [message #1246034] Fri, 14 February 2014 16:25 Go to next message
sarmistha pattnaik is currently offline sarmistha pattnaikFriend
Messages: 2
Registered: February 2014
Junior Member
Hi,

I have a BIRT report (.rptdesign file) with "Begin Date" and "End Date" as input parameter. I want to restrict the user to view only 1 month data. I have used the following code in the "validate" script of end_date input parameter.

if(DateTimeSpan.months(params["begin_date"],params["end_date"]) == 0){
true;
}else{
false;
}

This works but it does not tell user that he is allowed to view only 1 month data.
Instead it showing this message "org.eclipse.birt.report.service.api.ReportServiceException: The validation for parameter "end_date" fails.".Also the exception stack trace is shown to the user.

Whereas I want to show a custom error message to the user in the else block. The custom error message that I want to show is "Max allowed duration for the report is 1 month only".

If anyone could kindly tell me if at all it is feasible in BIRT or not
OR
otherwise kindly let me know what is the recommended way of showing error messages in BIRT reports?

I need this urgently. Hence will really appreciate any quick help. Thanks.
Re: Need Help on showing cus tom error message in BIRT re port [message #1246675 is a reply to message #1246034] Sat, 15 February 2014 09:46 Go to previous messageGo to next message
Colin Sutton is currently offline Colin SuttonFriend
Messages: 121
Registered: July 2009
Senior Member
sarmistha pattnaik <forums-noreply@xxxxxxxx> wrote:
> Hi,
>
> I have a BIRT report (.rptdesign file) with "Begin Date" and "End Date"
> as input parameter. I want to restrict the user to view only 1 month
> data. I have used the following code in the "validate" script of end_date input parameter.
>
> if(DateTimeSpan.months(params["begin_date"],params["end_date"]) == 0){
> true;
> }else{
> false;
> }
>
> This works but it does not tell user that he is allowed to view only 1 month data.
> Instead it showing this message
> "org.eclipse.birt.report.service.api.ReportServiceException: The
> validation for parameter "end_date" fails.".Also the exception stack
> trace is shown to the user.
>
> Whereas I want to show a custom error message to the user in the else
> block. The custom error message that I want to show is "Max allowed
> duration for the report is 1 month only".
>
> If anyone could kindly tell me if at all it is feasible in BIRT or not OR
> otherwise kindly let me know what is the recommended way of showing error
> messages in BIRT reports?
>
> I need this urgently. Hence will really appreciate any quick help. Thanks.

Just Ask the user for one date: 'Please enter a date in the month to be
shown', then no error message is needed.

--
Colin Sutton
Re: Need Help on showing cus tom error message in BIRT re port [message #1246823 is a reply to message #1246675] Sat, 15 February 2014 13:40 Go to previous messageGo to next message
sarmistha pattnaik is currently offline sarmistha pattnaikFriend
Messages: 2
Registered: February 2014
Junior Member
Hi Colin,

In my case, the requirement is User should have the flexibility to specify the begin date and end date for the report as there are cases when user may want to see data for any duration less than a month (e.g.3days/4days/7days/15days/26days).

But only in cases, when the duration is more than 1 month, then User should be shown an error message "Max allowed duration for the report is 1 month only".

Could you kindly suggest how can I show custom error message to the user in those cases when the duration exceeds 1 month? In other words, I wanted to know whether it is feasible or not in BIRT to show a custom error message to user? If feasible, then what is the recommended way implementing the same?

Thanks in advance.
icon6.gif  Re: Need Help on showing cus tom error message in BIRT re port [message #1249437 is a reply to message #1246823] Tue, 18 February 2014 08:54 Go to previous message
Kushal Desai is currently offline Kushal DesaiFriend
Messages: 1
Registered: February 2014
Junior Member
Hi Sarmistha ,
Although there is no provision of showing a run time dialogue box in BIRT to satisfy the requirement, here is the work around Rolling Eyes
1. Create a global variable in initialize() method.
2. Create a label in the report.
3. Write your logic of if else in the onCreate() method of the label and display the error message.

If the logic fails and else block executes Very Happy , the report won't run for more than 1 month and it'll immediately throw the error in BIRT viewer.

Hope this helps!!


Thanks,
Kushal Cool
Previous Topic:Birt vierwer and Birt Taglib bug from different webapp
Next Topic:Obtaining value from previous row in cube
Goto Forum:
  


Current Time: Wed Apr 24 18:12:41 GMT 2024

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

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

Back to the top