Wed. Jan 26th, 2022

Requirement: I have an Oracle ADF Table displaying the Departments table data. Now, I want to add one more column with the name as Serial Number as the first column in the Departments Table.

Screen shot of the requirement is as below:

Solution: For solution of the above requirement follow the steps as shown below:

Step 1: Go to table properties and set varStatus=”vs”

Step 2: Drag and drop an af:column inside the table as the first column. Set headerText=”Serial Number”

Step 3: Drag and drop an af:outputText inside the column dragged and dropped in Step2.

Step 4: Set the value of the af:outputText as #{vs.index+1}

For this, go to the Value property > Click Expression Builder > Expand vs > Click index > Click add (+) from the Operands section > Add 1

Thus, the complete demo.jspx code is shown below.

<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="" version="2.1" xmlns:f=""
    < contentType="text/html;charset=UTF-8"/>
        <af:document title="demo.jspx" id="d1">
            <af:messages id="m1"/>
            <af:form id="f1">
                <af:table value="#{bindings.DepartmentsVO1.collectionModel}" var="row"
                          emptyText="#{bindings.DepartmentsVO1.viewable ? 'No data to display.' : 'Access Denied.'}"
                          rowSelection="single" fetchSize="#{bindings.DepartmentsVO1.rangeSize}" id="t1" varStatus="vs">
                    <af:column id="c5" headerText="Serial Number" sortable="true">
                        <af:outputText value="#{vs.index + 1}" id="ot5"/>
                    <af:column headerText="#{bindings.DepartmentsVO1.hints.DepartmentId.label}" id="c1"
                               sortProperty="#{}" sortable="true">
                        <af:outputText value="#{row.DepartmentId}"
                                       shortDesc="#{bindings.DepartmentsVO1.hints.DepartmentId.tooltip}" id="ot1">
                            <af:convertNumber groupingUsed="false"
                    <af:column headerText="#{bindings.DepartmentsVO1.hints.DepartmentName.label}" id="c2"
                               sortProperty="#{}" sortable="true">
                        <af:outputText value="#{row.DepartmentName}"
                                       shortDesc="#{bindings.DepartmentsVO1.hints.DepartmentName.tooltip}" id="ot2"/>
                    <af:column headerText="#{bindings.DepartmentsVO1.hints.ManagerId.label}" id="c3"
                               sortProperty="#{}" sortable="true">
                        <af:outputText value="#{row.ManagerId}"
                                       shortDesc="#{bindings.DepartmentsVO1.hints.ManagerId.tooltip}" id="ot3">
                            <af:convertNumber groupingUsed="false"
                    <af:column headerText="#{bindings.DepartmentsVO1.hints.LocationId.label}" id="c4"
                               sortProperty="#{}" sortable="true">
                        <af:outputText value="#{row.LocationId}"
                                       shortDesc="#{bindings.DepartmentsVO1.hints.LocationId.tooltip}" id="ot4">
                            <af:convertNumber groupingUsed="false"

Save all and run the application. Thus, the ran application is shown below:

Note: Even if we sort (ascending or descending order) the Departments table data based on DepartmentId, DepartmentName, ManagerId, or LocationId, still the Serial Number will be displayed in a sequential manner starting from 1.

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 422 total views,  1 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *