Path: utzoo!attcan!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.databases Subject: Re: ORACLE SQLFORMS GLOBAL VARIABLES Keywords: ORACLE SQLFORMS GLOBAL Message-ID: <953@philmds.UUCP> Date: 14 Feb 89 09:07:44 GMT References: <635@hechcx.HEC.HARRIS.COM> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 45 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.