Re: To skip or not to skip a field in SQL*FORMS

From: <champs_at_cnb07v.hhcs.gov.au>
Date: 26 May 93 09:34:11 +1000
Message-ID: <1993May26.093411.1_at_cnb07v.hhcs.gov.au>


In article <1993May24.192249.27099_at_macc.wisc.edu>, dly_at_vms.macc.wisc.edu writes:
> This is a SQL*FORMS 3.0 question.
>
> Here is the problem:
> We have data entry screens which have date fields. If there is no date,
> we require the data entry person to put a two char code in to explain
> why there was no date. For example:
>
> Date of Birth: __ __ /__ __ /__ __ code:__ __ Weight: __ __ __ . __
>
> Here is what I want:
> 1) If there is a valid date entered, I want FORMS to skip over the code
> field. If there is no date, I want FORMS to allow the user to enter the
> code.
>
> 2) If the user goes past the code field, to the Weight field and presses
> the KEY-PRVFLD, I want FORMS to go back to the Date of Birth Field,
> bypassing the code field.
>
> By brute force we can define a trigger for the code field:
> ON-NEW-FIELD-INSTANCE and say:
> if :A.DOB is not null then
> next_field;
> end if;
>
> And also another trigger for the Weight field:
> KEY-PRVFLD
> go_field('DOB');
>
> Is there a better way? I tried playing around with SYSTEM.CURRENT_FIELD,
> but I could not find anything elegant. Since we have over 200 places
> where we would like this done, we would like a more general solution
> if possible. Oracle Technical Support was no help.
>
> Thanks,
> Debbie Yoshihara
> University of Wisconsin
> Department of Biostatistics

Firstly, give all the fields that might be skipped a common prefix eg SIN_ (Skip If Null) this will allow you to identify them from a generic procedure or trigger.

Then you cound use either form level KEY-NXTFLD and KEY-PRVFLD or two procedures (one for each direction) that you could call from your block or field level KEY-NXTFLD and KEY-PRVFLD triggers.

Regardless of where you put the code it should look something like this:

NB: this code should be executed while cursor is still in the field that determines whether the skip takes place (ie. DOB in your example).

KEY-NXTFLD or next_field procedure

if :SYSTEM.CURSOR_VALUE in not null and

   substr(FIELD_CHARACTERISTIC(:SYSTEM.CURSOR_FIELD,NEXTFIELD),1,4) = 'SIN_' then

   next_field; -- this frees us from having to know the field names

  • this is the extra next_field needed to cause the skip end if;

next_field; -- this is the one we do for every field

KEY-PRVFLD or previous_field procedure

previous_field; -- leaves us in the field that might be skipped

if substr(:SYSTEM.CURSOR_FIELD,1,4) = 'SIN_' and   NAME_IN(FIELD_CHARACTERISTIC(:SYSTEM.CURSOR_FIELD,PREVIOUSFIELD)) is not null then

   previous_field; -- this will skip the field end if;

Hope this is what you were looking for

Bye for now.


    /\       Steven Champness (champs_at_cnb07v.hhcs.gov.au)
   /  \      Dept of Health, Housing, Local Govt and Community Services
  /    \     Brisbane, Queensland via Canberra, Australia
 /      \    

/ / \ The opinions expressed above were forcibly implanted in my head \ / / / by aliens from Alpha Zeltex 4, during a recent Invasion attempt.  \/ / / /
  \/ / /     MACINTOSH      : If you need a manual to operate it, it wasn't
   \/ /      SOFTWARE AXIOM : designed properly in the first place !!!!
    \/ Received on Wed May 26 1993 - 01:34:11 CEST

Original text of this message