Which Tabular Form Column is mapped to which Apex_Application.g_fxx array?

Have you ever asked yourself how Oracle APEX maps the columns of a Tabular Form to the Apex_Application.g_fxx (alias Htmldb_Application.g_fxx, alias WWV_Flow.g_fxx) array?

I think most developers use one of the following methods to get the correct mapping:

  • Look at the generated HTML output of the page and get the name attribute of the INPUT element
  • Use eg. Firebird to inspect the column field and get again the value set for the name attribute.

But did you know that the algorithm which APEX is using is quite simple?

APEX takes your Tabular Form select statement and based on the order in which the columns are appearing in the select statement (not in the order you see on the Report Attributes tab!) it starts mapping

  1. if the column is a “Saves state” column, that means it is rendered as HTML field and
  2. if the condition/authorization matches

it will increase the field counter.

Note: If you have a row selector, this column will always map to g_f01

Example:

SELECT EMPNO
     , EMPNO AS EMPNO_DISPLAY
     , FIRST_NAME
     , LAST_NAME
     , HIRE_DATE
  FROM EMP

Let’s assume that all fields except of EMPNO_DISPLAY are rendered as fields and LAST_NAME has a condition which isn’t TRUE.

EMPNO = g_f01
EMPNO_DISPLAY = not mapped
FIRST_NAME = g_f02
LAST_NAME = not mapped because of condition
HIRE_DATE = g_f03

In the case if we have a Row Selector.

Row-Selector = g_f01
EMPNO = g_f02
EMPNO_DISPLAY = not mapped
FIRST_NAME = g_f03
LAST_NAME = not mapped because of condition
HIRE_DATE = g_f04

If you don’t want to hassle around with that mapping, where you also have to consider the conditions/authorizations, …, you may should take a look at the Plug & Play Tabular Form Handling of the ApexLib Framework.

4 thoughts on “Which Tabular Form Column is mapped to which Apex_Application.g_fxx array?

  1. Pretty neat, except… what if you have more than one select statements on the page, aka more than one tables on the page.

    REPORT 1
    col1 col2 col3

    REPORT2
    col4 col5

    If I wanted to access col4 and col5 using the G_Fxx, how would I?

  2. Hi Maranello,

    APEX doesn’t support 2 or more updateable tabular forms (out of the box) on a page. If you want to do that you have to create the fields with the Apex_Item.* calls by yourself. And in that case you specify to which array the column is mapped.

    Patrick

  3. Pingback: Checkboxen in Tabular Form - Ganz Einfach! | Der Oracle APEX Experten Blog

  4. Dear Patrick,

    How can I delete the last added row from the apex_application.g_fxxx array? Eg. I add a row, but then realise I don’t need it. How can I delete that row?

    Kind regards,

    Maurice Niezen

Comments are closed.