Report parameter Validation [message #352503] |
Wed, 08 October 2008 01:43 |
Medix
Messages: 1 Registered: April 2008
|
Junior Member |
|
|
Is it possible to validate the report parameter on the client end, before actually submitting the report parameter form to the application server ?
Scenario:
A report parameter form which takes a Date and then generate a report against it.
User is entering an invalid date in date parameter field "Abcdefghh" and clicks the submit button, a new web page opens with following error message.
---------------------------------------------------------------
REP-546: Value does not match mask 'dd/mm/yyyy'.
ORA-01858: a non-numeric character was found where a numeric was expected
REP-0091: Invalid value for parameter 'DTE'.
----------------------------------------------------------------
Is it possible that, this error can be handled at the browser (client end), can we apply data validation check on the date parameter field ?
Parameter form field has a property validation trigger can it be used for this purpose, if yes then please explain how.
Thank you.
|
|
|
Re: Report parameter Validation [message #352641 is a reply to message #352503] |
Wed, 08 October 2008 14:22 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Well, you could try to do the following: create a CHARACTER (not date) parameter and convert it to a date using the TO_DATE function. If it fails, display an error. Something like this:
l_date date;
begin
l_date := to_date(:par_date, 'dd.mm.yyyy');
return (TRUE);
exception
when others then
srw.message(10, 'Date format should be DD.MM.YYYY');
raise srw.program_abort;
end;
Beware of the WHEN OTHERS exception handler, as it will catch everything.
The other option might be creating your own parameter form (using Forms Builder, for example), let user enter date value and intercept possible error in a form, before actually calling the report (if everything is OK, you'd, of course, pass date parameter from a form to a report).
|
|
|