|
Re: CREATING GLOBAL VARIABLES IN FORM BUILDER [message #131538 is a reply to message #131536] |
Mon, 08 August 2005 02:42 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/67467.jpg) |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
You just assign the value to ':global.my_value' and then test it in the other form.
CLEAR_BLOCK examples
/*
** Built-in: CLEAR_BLOCK
** Example: Clears the current block without validation, and
** deposits the primary key value which the user
** has typed into a global variable which a
** Pre-Query trigger will use to include it as a
** query criterion.
** Trigger: When-New-Item-Instance
*/
BEGIN
IF :Emp.Empno IS NOT NULL THEN
:Global.Employee_Id := :Emp.Empno;
Clear_Block (No_Validate);
END IF;
END;
/*
** Trigger: Pre-Query
*/
BEGIN
Default_Value (NULL, 'Global.Employee_Id');
IF :Global.Employee_Id IS NOT NULL THEN
:Emp.Empno := :Global.Employee_Id;
END IF;
END;
You need to use the 'default_value' just in case it has not been set.
COPY examples
-- Example 1
/*
** Built-in: COPY
** Example: Force a wildcard search on the EmpNo item during
** query.
** Trigger: Pre-Query
*/
DECLARE
cur_val VARCHAR2 (40);
BEGIN
/*
** Get the value of EMP.EMPNO as a string
*/
cur_val := Name_In ('Emp.Empno');
/*** Add a percent to the end of the string.
*/
cur_val := cur_val || '%';
/*
** Copy the new value back into the item so Form Builder
** will use it as a query criterion.
*/
Copy (cur_val, 'Emp.Empno');
END;
-- Example 2
/*
** Built-in: COPY
** Example: Set the value of a global variable whose name is
** dynamically constructed.
*/
DECLARE
global_var_name VARCHAR2 (80);
BEGIN
IF :Selection.Choice = 5 THEN
global_var_name := 'Storage_1';
ELSE
global_var_name := 'Storage_2';
END IF;
/*
** Use the name in the 'global_var_name' variable as the
** name of the global variable in which to copy the
** current 'Yes' value.
*/
COPY ('Yes', 'GLOBAL.' || global_var_name);
END;
And remember to erase it when you are finished with it.
ERASE examples
David
[Updated on: Mon, 08 August 2005 02:48] Report message to a moderator
|
|
|
|