How to handle warnings in QUICK

David Morrison - Corporate dmorrison@mcbrideelectric.com
Fri, 20 Feb 2004 09:12:48 -0800


Thanks, Rick.  I'll take a look at incorporating this logic.

David Morrison


-----Original Message-----
From: Rick Hill [mailto:rmhill@core.com]
Sent: Friday, February 20, 2004 10:45 AM
To: David Morrison - Corporate
Cc: powerh-l@sowder.com
Subject: Re: How to handle warnings in QUICK


Hi David, 

The two questions sound similar.  For the first situation, it sounds
like you want to give a warning at the time the data is entered in
a_field, and also give the same or a similar warning after receiving
input into other fields (such as important_field) -- if a certain value
was recorded in one or more other fields, like a_field.  

If that's the case, consider handling it in the PROCESS procedure for
the other fields.  For example,

PROCEDURE EDIT a_field     ; similar to what you had
BEGIN
    IF a_field = "Y"
    THEN BEGIN
         LET t_warning_flag = "Y"
         WARNING  "WARNING: a_field = Y"  NOW
    END  LET t_warning_flag = "N"
    ELSE 
END

PROCEDURE EDIT b_field     
BEGIN
    IF b_field = "Y"
    THEN BEGIN
         LET t_warning_flag = "Y"
         WARNING  "WARNING: b_field = Y"  NOW
    END
END

PROCEDURE PROCESS important_field
BEGIN
     IF t_warning_flag = "Y"
       THEN WARNING  "BE CAREFUL!  Either a_field or b_field = Y"  NOW
END


The second question sounds like the same issue.  In situations like
this, one approach I've used is to have an internal procedure with the
logic that determines whether or not a warning should be issued, and
then DO that procedure in the EDIT or PROCESS procedures for every field
where there could be a data issue.  This handles all situations,
including where the fields are spread out all over the screen and where
the user might find the record and go directly to just one field to
change its value and update.  For example, ...

PROCEDURE INTERNAL CHECK
BEGIN
    IF important_field_1 = "Y" and important_field_2 = "Y" 
    THEN WARNING "THESE FIELDS SHOULD HAVE DIFFERENT VALUES!" NOW
END

PROCEDURE PROCESS important_field_1
BEGIN
     DO INTERNAL check
END

PROCEDURE PROCESS important_field_2
BEGIN
     DO INTERNAL check
END


Hope this helps!

Rick Hill



> David Morrison - Corporate wrote:
> 
> Hello, all
> 
> I'd like to get some input on what techniques you have developed for
> handling warnings in QUICK.
> 
> Generally speaking, a warning message should be displayed only if
> there are no errors, and it would be displayed only once.  But what
> if, after displaying an error and/or warning, the user changes the
> data in other fields; under some conditions the warning should be
> re-displayed, right?  How do you handle that?  We resort to setting a
> flag if the warning condition is met, but I haven't gone to the
> trouble of re-setting the flag if an important field that affects the
> warning is changed.
> 
> PROCEDURE EDIT a_field
> 
> BEGIN
> 
> IF a_field = "Y" AND t_warning_flag = "N"
> 
> THEN BEGIN
> 
>                          LET t_warning_flag = "Y"
> 
>          WARNING  "WARNING: a field = Y"  NOW
> 
> END
> 
> END
> 
> PROCEDURE INPUT important_field
> 
> BEGIN
> 
>         LET t_warning_flag = "N"
> 
> END
> 
> Secondly, how do you like to handle warning conditions based on
> multiple input fields?  I prefer to use the EDIT subroutine for a
> SILENT field, rather than PREUPDATE, but neither one works entirely
> satisfactorily.   We've had cases where the warning message has
> superseded an error message!
> 
> Thanks in advance for your feedback.
> 
> David Morrison
> 
> McBride Electric