A short cut to display row numbers for each record on UI

In this post, I'm sharing a tip to display row numbers along with data in each row on UI. Idea is to modify the ViewObject's query to use ROW_NUMBER(). You may need to be measured if the number of records in the table are large in size (because of the obvious performance issues).

SQL for a typical ViewObject may look like as shown below,
SELECT ROW_NUMBER() OVER(ORDER BY  Employees.FIRST_NAME)AS ROW_NUMBER , Employees.EMPLOYEE_ID, 
       Employees.FIRST_NAME, 
       Employees.LAST_NAME, 
       Employees.EMAIL, 
       Employees.PHONE_NUMBER
FROM EMPLOYEES Employees

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]

Comments

  1. Hi,
    You can also use the table's varStatus context as described in Fusion development guide book.

    The table varStatus attribute defines the name for the table context variable that exists for the
    time the table is rendered.

    Here are the steps

    1. Add a column in a table with output text.

    2. set outputText value to #{vs.index+1}

    Baig,
    http://baigsorcl.blogspot.com/

    ReplyDelete
  2. thanks Baig, Suggestion sounds good(even better) for tableUI display. However, I'm not sure whether this help for 'Paginated' Form UI.

    ReplyDelete

Post a Comment