PDA

View Full Version : Error message customization



Mike Cooper
9-Sep-2005, 10:47 AM
For the life of me, I can't figure out how to customize a Status 28
(Duplicate Recs Not allowed) message for one of the files in the web app...

In one of the WBOs I want to customize this message so that it reads "The
Login ID that you have selected is already taken." rather than "Duplicate
Records Not Allowed".

I have scanned this NG and tried a couple of things that I have found, but
can't seem to get anything to work... I thought this should be simple...

I read about Extended_Error_Messages in the help, but with the lack of any
examples, I can't seem to understand how to implement this either.

Any help appreciated.

--
Grasp Software Corporation
www.grasp.ca

Mike Cooper
9-Sep-2005, 12:23 PM
Found the answer in the archives from Marco Kuipers... (Thanks Marco)

//SNIP
I find the message 'Dupplicate records not allowed' not very pretty.
In my application the following message was displayed:

"Duplicate records not allowed in file
C:\NCIWeb\NCIVDF\Data\propacc.k1"

I've got several problems with this:
1) The user does not know whats going on and might descide
to leave the site... (It's 'broken'?!)
2) Unnecessary information is displayed in the location of
the datafile on the WebServer!
3) The users are ought to know what this index is...
In VDF hard to sell but in WebApp impossible...

So what I wanted was a message like:
This Username is already in Use!
Please enter another one

To do this i'd to do add functionality to the Error reporting class to
change the message into my custom error.

Place this in your WBO (before your cWebBusinessProcess object):
----------------- Start ----------------------------
Class cErrorMessageChange is an ISOError
Procedure ChangeErrorText Integer iError String sErrMsg
Set Value of (oErrorText(self)) item iError to sErrMsg
End_Procedure
end_class
Import_Class_Protocol cErrorMessageChange ISOError All
----------------- End ----------------------------

Place this in your cWebBusinessProcess object:
----------------- Start ----------------------------
Function DoRequestSave String sFileName Returns String
String sRetval sIP sVisit
Forward Get DoRequestSave sFileName To sRetval

Integer iErrorCount iIndex iPos
String sErrorMessage
For iErrorCount From 0 To (ErrorCount(Self))
If (Error_ErrNr(oISOError(Self),iErrorCount)) Eq 28 Begin
Get Error_ErrMsg Of (oISOError(Self)) iErrorCount ;
To sErrorMessage
Move ((Pos(".K",(Uppercase(sErrorMessage))))+2) To iPos
Move (Mid(sErrorMessage,99,iPos)) To iIndex
If iIndex Eq 1 Send ChangeErrorText To (oISOError(Self)) ;
iErrorCount ;
"This Username is already in Use! \n Please enter another one"
If iIndex Eq 2 Send ChangeErrorText To (oISOError(Self));
iErrorCount ;
"This contact person has already an NCIWeb-Proposal account!
\n Please contact NCI for details"
End
Loop

Function_Return sRetval
End_Procedure
----------------- End ----------------------------

This will do the Trick...

I've send a suggestion for a next release to DAC to make this a
DBBuilder feature. Define an error message per Index in the DataBase
Builder.

Good luck with it and keep me informed of any improvements /
additions.

//end of SNIP


--
Grasp Software Corporation
www.grasp.ca
"Michael R. Cooper" <mcooper@grasp.ca> wrote in message
news:6qwOhVVtFHA.2212@dacmail.dataaccess.com...
> For the life of me, I can't figure out how to customize a Status 28
> (Duplicate Recs Not allowed) message for one of the files in the web
app...
>
> In one of the WBOs I want to customize this message so that it reads "The
> Login ID that you have selected is already taken." rather than "Duplicate
> Records Not Allowed".
>
> I have scanned this NG and tried a couple of things that I have found, but
> can't seem to get anything to work... I thought this should be simple...
>
> I read about Extended_Error_Messages in the help, but with the lack of any
> examples, I can't seem to understand how to implement this either.
>
> Any help appreciated.
>
> --
> Grasp Software Corporation
> www.grasp.ca
>
>

Marco
11-Sep-2005, 11:35 PM
Thanks Michael,

Just a shame that we're a couple of versions further and DAW has not
given this a priority yet.

Have resubmitted the suggestion, just in case (WBR-2824).

Cheers,
Marco

On Fri, 9 Sep 2005 13:23:28 -0400, "Michael R. Cooper"
<mcooper@grasp.ca> wrote:

>Found the answer in the archives from Marco Kuipers... (Thanks Marco)
>
>//SNIP
>I find the message 'Dupplicate records not allowed' not very pretty.
>In my application the following message was displayed:
>
>"Duplicate records not allowed in file
>C:\NCIWeb\NCIVDF\Data\propacc.k1"
>
>I've got several problems with this:
>1) The user does not know whats going on and might descide
> to leave the site... (It's 'broken'?!)
>2) Unnecessary information is displayed in the location of
> the datafile on the WebServer!
>3) The users are ought to know what this index is...
> In VDF hard to sell but in WebApp impossible...
>
>So what I wanted was a message like:
>This Username is already in Use!
>Please enter another one
>
>To do this i'd to do add functionality to the Error reporting class to
>change the message into my custom error.
>
>Place this in your WBO (before your cWebBusinessProcess object):
>----------------- Start ----------------------------
>Class cErrorMessageChange is an ISOError
> Procedure ChangeErrorText Integer iError String sErrMsg
> Set Value of (oErrorText(self)) item iError to sErrMsg
> End_Procedure
>end_class
>Import_Class_Protocol cErrorMessageChange ISOError All
>----------------- End ----------------------------
>
>Place this in your cWebBusinessProcess object:
>----------------- Start ----------------------------
>Function DoRequestSave String sFileName Returns String
> String sRetval sIP sVisit
> Forward Get DoRequestSave sFileName To sRetval
>
> Integer iErrorCount iIndex iPos
> String sErrorMessage
> For iErrorCount From 0 To (ErrorCount(Self))
> If (Error_ErrNr(oISOError(Self),iErrorCount)) Eq 28 Begin
> Get Error_ErrMsg Of (oISOError(Self)) iErrorCount ;
> To sErrorMessage
> Move ((Pos(".K",(Uppercase(sErrorMessage))))+2) To iPos
> Move (Mid(sErrorMessage,99,iPos)) To iIndex
> If iIndex Eq 1 Send ChangeErrorText To (oISOError(Self)) ;
> iErrorCount ;
> "This Username is already in Use! \n Please enter another one"
> If iIndex Eq 2 Send ChangeErrorText To (oISOError(Self));
> iErrorCount ;
> "This contact person has already an NCIWeb-Proposal account!
>\n Please contact NCI for details"
> End
> Loop
>
> Function_Return sRetval
>End_Procedure
>----------------- End ----------------------------
>
>This will do the Trick...
>
>I've send a suggestion for a next release to DAC to make this a
>DBBuilder feature. Define an error message per Index in the DataBase
>Builder.
>
>Good luck with it and keep me informed of any improvements /
>additions.
>
>//end of SNIP

Evertjan Dondergoor
12-Sep-2005, 02:27 AM
Marco, Michael,

I've used a similar thing to add this feature, but stopped doing so. Problem
is when you migrate to MS-SQL or P.SQL (and maybe also other drivers/DB) the
error message doesn't include anymore what index you're having the duplicate
record on. So this stops working once you migrate (which happens more often
then not for me).

Therefore nowadays I just check before saving if an loginid is already in
use. It is just more reliable.

Just some thoughts,
Evertjan



"Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
news:qo0ai1p8ibcno36skp3767dq7ra7vri6pk@4ax.com...
> Thanks Michael,
>
> Just a shame that we're a couple of versions further and DAW has not
> given this a priority yet.
>
> Have resubmitted the suggestion, just in case (WBR-2824).
>
> Cheers,
> Marco
>
> On Fri, 9 Sep 2005 13:23:28 -0400, "Michael R. Cooper"
> <mcooper@grasp.ca> wrote:
>
>>Found the answer in the archives from Marco Kuipers... (Thanks Marco)
>>
>>//SNIP
>>I find the message 'Dupplicate records not allowed' not very pretty.
>>In my application the following message was displayed:
>>
>>"Duplicate records not allowed in file
>>C:\NCIWeb\NCIVDF\Data\propacc.k1"
>>
>>I've got several problems with this:
>>1) The user does not know whats going on and might descide
>> to leave the site... (It's 'broken'?!)
>>2) Unnecessary information is displayed in the location of
>> the datafile on the WebServer!
>>3) The users are ought to know what this index is...
>> In VDF hard to sell but in WebApp impossible...
>>
>>So what I wanted was a message like:
>>This Username is already in Use!
>>Please enter another one
>>
>>To do this i'd to do add functionality to the Error reporting class to
>>change the message into my custom error.
>>
>>Place this in your WBO (before your cWebBusinessProcess object):
>>----------------- Start ----------------------------
>>Class cErrorMessageChange is an ISOError
>> Procedure ChangeErrorText Integer iError String sErrMsg
>> Set Value of (oErrorText(self)) item iError to sErrMsg
>> End_Procedure
>>end_class
>>Import_Class_Protocol cErrorMessageChange ISOError All
>>----------------- End ----------------------------
>>
>>Place this in your cWebBusinessProcess object:
>>----------------- Start ----------------------------
>>Function DoRequestSave String sFileName Returns String
>> String sRetval sIP sVisit
>> Forward Get DoRequestSave sFileName To sRetval
>>
>> Integer iErrorCount iIndex iPos
>> String sErrorMessage
>> For iErrorCount From 0 To (ErrorCount(Self))
>> If (Error_ErrNr(oISOError(Self),iErrorCount)) Eq 28 Begin
>> Get Error_ErrMsg Of (oISOError(Self)) iErrorCount ;
>> To sErrorMessage
>> Move ((Pos(".K",(Uppercase(sErrorMessage))))+2) To iPos
>> Move (Mid(sErrorMessage,99,iPos)) To iIndex
>> If iIndex Eq 1 Send ChangeErrorText To (oISOError(Self)) ;
>> iErrorCount ;
>> "This Username is already in Use! \n Please enter another one"
>> If iIndex Eq 2 Send ChangeErrorText To (oISOError(Self));
>> iErrorCount ;
>> "This contact person has already an NCIWeb-Proposal account!
>>\n Please contact NCI for details"
>> End
>> Loop
>>
>> Function_Return sRetval
>>End_Procedure
>>----------------- End ----------------------------
>>
>>This will do the Trick...
>>
>>I've send a suggestion for a next release to DAC to make this a
>>DBBuilder feature. Define an error message per Index in the DataBase
>>Builder.
>>
>>Good luck with it and keep me informed of any improvements /
>>additions.
>>
>>//end of SNIP

Mike Cooper
12-Sep-2005, 06:58 AM
Thanks Evertjan

I was thinking about doing this but cringe whenever I try to mix a procedure
with a DD event when the finding of different records is concerned... For
me I either use all Procedural or all DD and since I already had the one web
screen written using a DD I was really just looking for a simple way to
intercept the error and change the wording. Thanks for your heads up
though.

Cheers, mIke

--
Grasp Software Corporation
www.grasp.ca
"Evertjan Dondergoor" <evertjan.dondergoor@dataaccess.nl> wrote in message
news:e59P7t2tFHA.1276@dacmail.dataaccess.com...
> Marco, Michael,
>
> I've used a similar thing to add this feature, but stopped doing so.
Problem
> is when you migrate to MS-SQL or P.SQL (and maybe also other drivers/DB)
the
> error message doesn't include anymore what index you're having the
duplicate
> record on. So this stops working once you migrate (which happens more
often
> then not for me).
>
> Therefore nowadays I just check before saving if an loginid is already in
> use. It is just more reliable.
>
> Just some thoughts,
> Evertjan
>
>
>
> "Marco Kuipers" <marco.kuipers@nci.com.au> wrote in message
> news:qo0ai1p8ibcno36skp3767dq7ra7vri6pk@4ax.com...
> > Thanks Michael,
> >
> > Just a shame that we're a couple of versions further and DAW has not
> > given this a priority yet.
> >
> > Have resubmitted the suggestion, just in case (WBR-2824).
> >
> > Cheers,
> > Marco
> >
> > On Fri, 9 Sep 2005 13:23:28 -0400, "Michael R. Cooper"
> > <mcooper@grasp.ca> wrote:
> >
> >>Found the answer in the archives from Marco Kuipers... (Thanks Marco)
> >>
> >>//SNIP
> >>I find the message 'Dupplicate records not allowed' not very pretty.
> >>In my application the following message was displayed:
> >>
> >>"Duplicate records not allowed in file
> >>C:\NCIWeb\NCIVDF\Data\propacc.k1"
> >>
> >>I've got several problems with this:
> >>1) The user does not know whats going on and might descide
> >> to leave the site... (It's 'broken'?!)
> >>2) Unnecessary information is displayed in the location of
> >> the datafile on the WebServer!
> >>3) The users are ought to know what this index is...
> >> In VDF hard to sell but in WebApp impossible...
> >>
> >>So what I wanted was a message like:
> >>This Username is already in Use!
> >>Please enter another one
> >>
> >>To do this i'd to do add functionality to the Error reporting class to
> >>change the message into my custom error.
> >>
> >>Place this in your WBO (before your cWebBusinessProcess object):
> >>----------------- Start ----------------------------
> >>Class cErrorMessageChange is an ISOError
> >> Procedure ChangeErrorText Integer iError String sErrMsg
> >> Set Value of (oErrorText(self)) item iError to sErrMsg
> >> End_Procedure
> >>end_class
> >>Import_Class_Protocol cErrorMessageChange ISOError All
> >>----------------- End ----------------------------
> >>
> >>Place this in your cWebBusinessProcess object:
> >>----------------- Start ----------------------------
> >>Function DoRequestSave String sFileName Returns String
> >> String sRetval sIP sVisit
> >> Forward Get DoRequestSave sFileName To sRetval
> >>
> >> Integer iErrorCount iIndex iPos
> >> String sErrorMessage
> >> For iErrorCount From 0 To (ErrorCount(Self))
> >> If (Error_ErrNr(oISOError(Self),iErrorCount)) Eq 28 Begin
> >> Get Error_ErrMsg Of (oISOError(Self)) iErrorCount ;
> >> To sErrorMessage
> >> Move ((Pos(".K",(Uppercase(sErrorMessage))))+2) To iPos
> >> Move (Mid(sErrorMessage,99,iPos)) To iIndex
> >> If iIndex Eq 1 Send ChangeErrorText To (oISOError(Self)) ;
> >> iErrorCount ;
> >> "This Username is already in Use! \n Please enter another one"
> >> If iIndex Eq 2 Send ChangeErrorText To (oISOError(Self));
> >> iErrorCount ;
> >> "This contact person has already an NCIWeb-Proposal account!
> >>\n Please contact NCI for details"
> >> End
> >> Loop
> >>
> >> Function_Return sRetval
> >>End_Procedure
> >>----------------- End ----------------------------
> >>
> >>This will do the Trick...
> >>
> >>I've send a suggestion for a next release to DAC to make this a
> >>DBBuilder feature. Define an error message per Index in the DataBase
> >>Builder.
> >>
> >>Good luck with it and keep me informed of any improvements /
> >>additions.
> >>
> >>//end of SNIP
>
>