Skip to main content

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

Baig said…
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/
Jobinesh said…
thanks Baig, Suggestion sounds good(even better) for tableUI display. However, I'm not sure whether this help for 'Paginated' Form UI.

Popular posts from this blog

How to set Bind Variable Values at runtime ?

In this post I'm sharing a couple of approaches for programmatically setting bind variables values at run time. This post is an attempt to explain 'When to use what ?'[ In case if you are familiar with 'Bind Variables' in ADF BC, please refer Section 5.10, Working with Bind Variables in Fusion Developer's Guide ]

1. Set the Bind Variable value using RowSet::setNamedWhereClauseParam(...)

You can use use the setNamedWhereClauseParam(...) method on the ViewObject interface (which extends oracle.jbo.RowSet) to set the value for bind variables. Please note this sets the value on default RowSet. In other words, this doesn't have any effect on the secondary RowSets that you/system generates.
ViewObject vo = am.findViewObject("EmployeesView1"); vo.setNamedWhereClauseParam("bindVarDeptId", new Number(10)); vo.executeQuery();
2. Set the Bind Variable value using ViewObject's VariableValueManager::setVariableValue(...)

VariableValueManager Ma…