Home » Developer & Programmer » Forms » CREATING GLOBAL VARIABLES IN FORM BUILDER
CREATING GLOBAL VARIABLES IN FORM BUILDER [message #131536] Mon, 08 August 2005 02:24 Go to next message
emadbsb
Messages: 334
Registered: May 2005
Location: egypt
Senior Member

Hii
i have a variable in a form "a" i want to sent it value to be displayed in form "b" how can i make it as a global variable to send it to form "b"
thx
Re: CREATING GLOBAL VARIABLES IN FORM BUILDER [message #131538 is a reply to message #131536] Mon, 08 August 2005 02:42 Go to previous messageGo to next message
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
ERASE('global.var');

David

[Updated on: Mon, 08 August 2005 02:48]

Report message to a moderator

Re: CREATING GLOBAL VARIABLES IN FORM BUILDER [message #131539 is a reply to message #131536] Mon, 08 August 2005 02:43 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Also consider passing the value as a parameter to the new form.

David
Previous Topic: key bindings
Next Topic: Display Image in the Image box
Goto Forum:
  


Current Time: Thu Sep 19 12:00:40 CDT 2024