Jump to content

BIRT Developer Center Download


Photo
- - - - -

how show custom error message to user in birt report


  • Please log in to reply
5 replies to this topic

#1 sarmistha_birt

sarmistha_birt

    Member

  • Members
  • PipPip
  • 13 posts

Posted 05 February 2014 - 03:58 AM

I have the following input parameters in the report 1. Begin Date 2. End Date I want to restrict the user to show only one month data. That I am able to achieve. But in case the duration is more than 1 month now it is showing birt exception that validation for begin date failed. Instead I want to show a custom message that "you are allowed to view only one month data". How can this be done? I have tried using javascript alert but it is not working. Kindly help.
  • Sai Krishna likes this

#2 BRM

BRM

    Senior Member

  • Members
  • 148 posts

Posted 05 February 2014 - 09:58 AM

Why not just get the Begin date and compute the end date?  That way the user doesn't have to enter it and so there is no need for the error checking.  If you have to have both parameters then you might look into cascading parameters which allow parameters to be dependent on other parameters.  You could get the Begin date and then compute the range of allowable end dates and so eliminate the possibility for error on the part of the user. 



#3 sarmistha_birt

sarmistha_birt

    Member

  • Members
  • PipPip
  • 13 posts

Posted 06 February 2014 - 09:51 AM

Hi, Is there a way to display custom error message using javascript alert?

#4 sarmistha_birt

sarmistha_birt

    Member

  • Members
  • PipPip
  • 13 posts

Posted 08 February 2014 - 10:46 PM

In our case, user will have the flexibility to enter any date as begin date and end date but the max allowed duration between begin date and end date is 1 month. So I am looking for a way if a java script alert can be shown if user selects a end date which is more than 1 month from the begin date. Kindly help.

#5 sarmistha_birt

sarmistha_birt

    Member

  • Members
  • PipPip
  • 13 posts

Posted 14 February 2014 - 01:47 AM

[font="tahoma, sans-serif;"][color=#000000;]Dear Experts,[/color][/font]

 

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]I have a report 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.[/color][/color][/font][/font]

 

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]if[/color][/color][/font][font="tahoma, sans-serif;"][color=#000000;](DateTimeSpan.months(params["begin_date"],params["end_date"]) == 0){[/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]true[/color][/color][/font][font="tahoma, sans-serif;"][color=#000000;];[/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]}else{[/color][/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]false[/color][/color][/font][font="tahoma, sans-serif;"][color=#000000;];[/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]}[/color][/color][/font][/font]

 

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]This works but it does not tell user that he is allowed to view only 1 month data. I want to show the following custom message:[/color][/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;] [/color][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]"Max allowed duration for the report is 1 month only".[/color][/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;] [/color][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]How can i achieve this? Kindly help.[/color][/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;] [/color][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]Thanks & Regards,[/color][/color][/font][/font]

[font="tahoma, sans-serif;"][color=#000000;][font="tahoma, sans-serif;"][color=#000000;]Sarmistha[/color][/color][/font][/font]



#6 Sai Krishna

Sai Krishna

    Advanced Member

  • Members
  • PipPipPip
  • 31 posts

Posted 19 June 2017 - 03:17 AM

I have the following input parameters in the report 1. Begin Date 2. End Date I want to restrict the user to show only one month data. That I am able to achieve. But in case the duration is more than 1 month now it is showing birt exception that validation for begin date failed. Instead I want to show a custom message that "you are allowed to view only one month data". How can this be done? I have tried using javascript alert but it is not working. Kindly help.

Hi Sarmistha,

 

I too have to display the custimized error instead of default error. Did you find any solution for your problem? If so could you please share your solution to me also.

 

Thanks in Advance,

 

-Sai


Thanks & Regards,
Sai