Home » Developer & Programmer » Forms » How to create Global variables dynamically with different names?
How to create Global variables dynamically with different names? [message #80757] Sun, 17 November 2002 14:11 Go to next message
Swamy
Messages: 78
Registered: June 2002
Member
I have a block name EMP with items LAST_NAME, FIRST_NAME, DEPT_NAME, SAL. I want to write a program unit to create Global variables dynamically for all the items. The Global variable names must include the names of the items, such as GLOBAL.LAST_NAME, GLOBAL.FIRST_NAME, etc., In the program unit, I am writing the code as below.

l_first_item_name := GET_BLOCK_PROPERTY(p_ block,FIRST_ITEM);
l_last_item_name := GET_BLOCK_PROPERTY(p_ block,LAST_ITEM);
IF :SYSTEM.CURSOR_ITEM <> p_ block||'.'||l_first_item_name THEN
GO_ITEM(p_ block||'.'||l_first_item_name);
l_current_item_name := l_first_item_name;
WHILE l_current_item_name <> l_last_item_name
LOOP
l_cursor_value := NAME_IN('SYSTEM.CURSOR_VALUE');

IF l_cursor_value IS NOT NULL THEN
IF INSTR(l_cursor_value,'%') > 0 OR INSTR(l_cursor_value,'_') > 0 THEN
:GLOBAL.l_current_item_name := l_current_item_name || ' = ''' || l_cursor_value || '''';
END IF;
ELSE
:GLOBAL.l_current_item_name := NULL;
END IF;
l_next_item_name := GET_ITEM_PROPERTY(p_ block||'.'||l_current_item_name,NEXTITEM);
GO_ITEM(p_data_block||'.'||l_next_item_name);
END LOOP;

Here, my problem is, :GLOBAL.l_current_item_name is not giving the respective Global names like GLOBAL.LAST_NAME, GLOBAL.FIRST_NAME, etc., instead it is giving only one global variable name GLOBAL.L_CURRENT_ITEM_NAME. Can any one suggest, how to achieve my goal? I appreciate in advance for your help.
Re: How to create Global variables dynamically with different names? [message #80762 is a reply to message #80757] Mon, 18 November 2002 04:47 Go to previous message
F. Tollenaar
Messages: 64
Registered: November 2002
Member
use copy instead of direct assignment :
 copy(:emp.ename, 'global.'||:emp.ename);


This creates a global named <value of field ename>.

hth,
Frank
Previous Topic: record group in multiple form session doesn't work
Next Topic: Forms 6i with Arabic
Goto Forum:
  


Current Time: Fri Mar 29 03:35:42 CDT 2024