Existance of a block in SQL*FORMS 3.0
Date: 8 Apr 92 18:37:00 GMT
Message-ID: <8APR199213374051_at_tm0006.lerc.nasa.gov>
Summary of determining the existance of a block in SQL*Forms 3.0:
Situation:
We are writing screens that pop-up blocks on the screen based on user inout. We did not want to "Hard-code" the block names, so we decided to store the block name in a file called :CONTROL.FORM_BLOCK_NAME. The user enters data into field :CONTROL.FORM_BLOCK_NAME. If a block with a name matching the user data exists then, then go to that block. If the block does not exist, then go to a block called GENERAL.
Solution:
In our key navigation trigger we have the following:
GO_BLOCK(NAME_IN(':CONTROL.FORM_BLOCK_NAME')); IF FORM_FAILURE THEN GO_BLOCK(NAME_IN(':CONTROL.FORM_BLOCK_NAME')); END IF;
where :CONTROL.FORM_BLOCK_NAME has data entered by the user. (That is could be a name of a block that does not exist in the form.)
On a form level ON-ERROR trigger:
IF ERROR_CODE = 40104 THEN :CONTROL.FORM_BLOCK_NAME := 'GENERAL'; ELSE MESSAGE(ERROR_TYPE||'-'||TO_CHAR(ERROR_CODE)||': '||ERROR_TEXT); BELL; END IF;
Caveat:
If Oracle changes it's error codes, then we will need to change the ON-ERROR trigger.
Sure would be easier to have a packaged function called BLOCK_EXISTS which returns TRUE if the passed block name exists in the form, or FALSE if it does not exist. Then we could do:
If BLOCK_EXISTS(NAME_IN(':CONTROL.FORM_BLOCK_NAME')) Then
GO_BLOCK(NAME_IN(':CONTROL.FORM_BLOCK_NAME'));
Else
GO_BLOCK('GENERAL');
End if;
We are working on a Procedure to emulate a BLOCK_EXISTS package function.
Thanks to everyone who responded with suggestions!!
+------------------------------------------------------------------------------+Received on Wed Apr 08 1992 - 20:37:00 CEST
| Michael A. Rife | Email: MAR7363_at_TM0006.LERC.NASA.GOV |
| Boeing Computer Support Services | |
| Space Station Freedom Project | |
| NASA Lewis Research Center | Phone: 216-734-9679 |
| Cleveland, Ohio | 216-433-5938 FTS 297 (NASA) |
+------------------------------------------------------------------------------+