6.1 Working with G_Fnn Arrays (Legacy)
Important:
Support for G_Fnn arrays is legacy and will be removed in a future release. Oracle recommends using interactive grids instead.The APEX_APPLICATION.G_Fnn
arrays (where nn ranges from 01
to 50
) are used with APEX_ITEM
functions to enable the dynamic generation of HTML form elements to an APEX page (such as APEX_ITEM.TEXT
and APEX_ITEM.SELECT_LIST
). On Page Submit, the item values are sent to the server and provided as the APEX_APPLICATION.G_Fnn
arrays.
Only use APEX_APPLICATION.G_Fnn
in an APEX_ITEM
context. For other contexts (such as plain array processing for PL/SQL code) use the APEX_T_VARCHAR2
type and the procedures and functions within the APEX_STRING
package.
Note:
When working withAPEX_APPLICATION.G_Fnn
, the TABLE_TO_STRING
and STRING_TO_TABLE
functions in APEX_UTIL
are deprecated. Use APEX_STRING.TABLE_TO_STRING
and APEX_STRING.STRING_TO_TABLE
instead.
Referencing G_Fnn Arrays
The following example uses APEX_ITEM
to manually create a tabular form on the EMP
table. Note that the ename
, sal
, and comm
columns use the APEX_ITEM.TEXT
function to generate an HTML text field for each row. Note also that each item in the query is passed a unique p_idx
parameter to ensure that each column is stored in its own array.
- On a new page, add a classic report with a SQL Query such as the following example:
SELECT empno, APEX_ITEM.HIDDEN(1,empno)|| APEX_ITEM.TEXT(2,ename) ename, APEX_ITEM.TEXT(3,job) job, mgr, APEX_ITEM.DATE_POPUP(4,rownum,hiredate,'dd-mon-yyyy') hiredate, APEX_ITEM.TEXT(5,sal) sal, APEX_ITEM.TEXT(6,comm) comm, deptno FROM emp ORDER BY 1
- Disable "Escape Special Characters" for all report columns (under the Security property in Page Designer).
- Add a Submit button to the page.
- Run the application.
Referencing Values Within an On Submit Process
You can reference the values posted by the tabular form using the PL/SQL variable APEX_APPLICATION.G_F01
to APEX_APPLICATION.G_F50
. Because this element is an array, you can reference values directly. For example, the following code block collects all employee names as a text block and stores it as the value of the P3_G_F01_CONTENTS
item:
:P3_G_F01_CONTENTS := '';
for i IN 1..APEX_APPLICATION.G_F01.COUNT LOOP
:P3_G_F01_CONTENTS := :P3_G_F01_CONTENTS
|| 'element '||I||' has a value of '||APEX_APPLICATION.G_F02(i) || chr(10);
END LOOP;
Note that check boxes displayed using APEX_ITEM.CHECKBOX
only contain values in the APEX_APPLICATION
arrays for those rows which are checked. Unlike other items (TEXT
, TEXTAREA
, and DATE_POPUP
) which can contain an entry in the corresponding APEX_APPLICATION
array for every row submitted, a check box only has an entry in the APEX_APPLICATION
array if it is selected.
Parent topic: APEX_APPLICATION