[comp.databases] ORACLE SQLFORMS GLOBAL VARIABLES

raym@hechcx.HEC.HARRIS.COM (Ray Morin) (02/10/89)

Hello,
      I was wondering if anyone out there may have come across the problem
I'm trying to solve, and has come up with a workable solution. I am currently
using Oracle version 5. I am working on a production tracking/reporting system
and the applications for this project have restaints on the amount of time it
takes to enter data being collected. The users are on the manufacturing floor 
and data collection should not effect their productivity.
                   I have some forms in which data from another form must be
entered before the current form can do it's thing. This data can be entered
via an employee entering the data by calling the form from a menu or
by the current form deciding that data is needed and calling the form that
gathers this data. 
                   I would like to use global variables to get information
from the calling form that are nessessary in the called form........BUT
this would (appearently) make it nessessary to create two separate forms
                   1) to be called from the shell to collect data 
                   2) to be called from another form and make use of
                      global variables.

BECAUSE I can't figure out how to make a form that will sometimes be able
to access global variables and at other times not because they do not exist
W/O a fatal error. I would like to be able to determine if a variable exist
or not and take action ( in a trigger ) based on that information.
                    I know this probably sounds odd but it would make for
a better user interface ( they would not have to make duplicate entries )
and would make maintenance on the software easier because there would only
be one form to maintain.
                     If anyone has any suggestion the help would be greatly
apppreciated. :-)



                                    Thanks,
                                    raym@hechcx.HEC.HARRIS.COM (Ray Morin)

                             
                        

leo@philmds.UUCP (Leo de Wit) (02/14/89)

In article <635@hechcx.HEC.HARRIS.COM> raym@hechcx.HEC.HARRIS.COM (Ray Morin) writes:
    []
|                   I have some forms in which data from another form must be
|entered before the current form can do it's thing. This data can be entered
|via an employee entering the data by calling the form from a menu or
|by the current form deciding that data is needed and calling the form that
|gathers this data. 
|                   I would like to use global variables to get information
|from the calling form that are nessessary in the called form........BUT
|this would (appearently) make it nessessary to create two separate forms
|                   1) to be called from the shell to collect data 
|                   2) to be called from another form and make use of
|                      global variables.
|
|BECAUSE I can't figure out how to make a form that will sometimes be able
|to access global variables and at other times not because they do not exist
|W/O a fatal error. I would like to be able to determine if a variable exist
|or not and take action ( in a trigger ) based on that information.
    []

It's easy. If I give you the solution, you'll probably say: why haven't I
thought of it? Anyway, here it goes:

Use ONE global variable to decide whether data is available in global
variables (call it DATA_READY), and make sure this variable is always
set. To overcome the problem that this variable is not set too when
running the form on its own, use a dummy form in this case that merely
sets DATA_READY to FALSE, then does a CALLFORM of your form (you can
combine this in dummy's STARTUP trigger). The form that makes data
available to your form should set DATA_READY to TRUE before calling it.

Now the form that uses the data can decide in its STARTUP trigger if
the global data is available and take appropriate actions (using the
CASE construct or COPY and SELECT). Alternatively, the DUMMY could
set all globals used by your form to default / null values before
calling it, but a disadvantage is that all those names have to be
available to dummy (more problems when globals are added etc.).

A totally different solution is to use a (temporary) table to transport
data between the forms. This has its own disadvantages: avoid
(implicit) locking of this table's rows, initialization of this table
when calling your form directly.

Hope this help -
                  Leo.