From: fgreene@hayes.com
Newsgroups: comp.databases.oracle
Subject: Re: Forms 3.0 - How do YOU do this?
Date: 17 Dec 92 09:12:45 EDT
Organization: Hayes Microcomputer Products, Norcross, GA

In article <1gnffmINN138@usenet.INS.CWRU.Edu>, cc312@cleveland.Freenet.Edu (Jennifer R. Amon) writes:
> In a previous article, bamon@ocvaxc.cc.oberlin.edu (ME) says:
> 
>>I'm once again faced with a forms change which is always a pain:
>>
>>Project : The users should not be able to modify (without some special
>>          action on their part) field_b in block_1 when field_a is
>>          non-null.
>>
>>This boils down to "don't let them do it by default, but give them a way
>>around the default."
>>
>>In the past, I've set some global when they attempt to make the change, and
>>then I reset it to something else if they press commit in response to a
>>"do you really want to do this?" prompt. Then I reset it again after the
>>commit.
>>
>>It works, but it's always a real trick keeping track of and properly
>>resetting the global variable.
>>
>>Does anybody have a better way to do this?
>>
> _____________________________________________________________________
> -- 
> Jennifer R. Amon       FREENET: aa1190@freenet.lorain.oberlin.edu
> Analyst/Programmer     FREENET: cc312@cleveland.freenet.edu
> Oberlin College       INTERNET: bamon@ocvaxc.cc.oberlin.edu
> Oberlin, OH 44074       BITNET: bamon@ocvaxc.bitnet
As I understand the problem, there are a total of five fields involved:

	FIELD1	the (possibly) null field under test

	FIELD2 	the field you are LEAVING when the test occurs

	FIELD3	the actual field under test.  i.e., If FIELD1 is null then
		enter this field -- If FIELD1 is not null and user says yes
		then update this field

	FIELD4	the alternate field to enter if FIELD1 is not null and
		user says no

	FIELD5	a test point to use to check the users response

Also, these conditions can occur from various combinations of these fields,
so:

	Attach a KEY-NXTFLD to FIELD2 that contains the following:

            if :field1 is null then 
               GO_FIELD('field3');
            else 
                :global.path1 := 'field3';
                :global.path2 := 'field4';
                go_field('field5');
            end if;

	FIELD5 is in a pop-up window with appropriate text to prompt 
	the user for a Y or N response.  Attach a KEY-NXTFLD trigger 
	to FIELD5 that says:

            if :field5 = 'Y' then
               go_field(name_in('global.path1'));
            elsif :field5 = 'N' then
               go_field(name_in('global.path2'));
	    else
	       message('*** ERROR - response must be Y or N');
	       bell;
               raise form_trigger_failure;
            end if;

Hope this helps.

  ---------------------------------------------------------------------------
  |      Frank Greene                  |          //////  //////             |
  |      DELPHI SYSTEMS, Inc.          |           ////    ////              |
  |      Telephone [615] 458-6032      |          ////    ////  //////       |
  |      324 Ootsima Way               |         ////    ////    ////        |
  |      Loudon, TN 37774              |        //////  //////  //////       |
  ----------------------------------------------------------------------------
  |         Of course, any opinions or suggestions are strictly my own       |
  ----------------------------------------------------------------------------

Newsgroups: comp.databases.oracle