Sorting Data in VBCS Tables

Sorting Data in VBCS Tables

In this section, we will see how to sort Table data in VBCS.

Let us consider the EmpBOData Business Object.

A screenshot of a computer

AI-generated content may be incorrect.

Let us create sample VBCS page with table based on above business object.

A screenshot of a computer

AI-generated content may be incorrect.

Run the application.

A screenshot of a computer

AI-generated content may be incorrect.

We want to sort this table data based on some specified column name.

When we use a business object, it creates an SDP variable.

For our example, empBODataListSDP is created as shown below.

Sorting to table data can be by using one of two options:

(A) orderBy
(B) sortCriteria

A screenshot of a computer

AI-generated content may be incorrect.

  1. Sorting Table Data using orderBy

Let us consider, we need to sort the table data based on the FirstName field.

Click on orderBy under SDP as highlighted above and provide FirstName in orderBy

A screenshot of a computer

AI-generated content may be incorrect.

Click on Save.

Run the application.

A screenshot of a computer

AI-generated content may be incorrect.

We can see, data is sorted based on firstName in ascending order.

We can sort data based on firstName in descending order using desc as shown below:

A screen shot of a computer

AI-generated content may be incorrect.

Click on Save.

Run the application.

A screenshot of a computer

AI-generated content may be incorrect.

Data is sorted now based on firstName in descending order.

We can also add multiple columns for sorting data as shown below:

A screen shot of a computer

AI-generated content may be incorrect.

Click on Save.

Run the application.

A screenshot of a computer

AI-generated content may be incorrect.

  1. Sorting Table Data using sortCriteria.

To sort table data using sorting Criteria, click on sortCriteria:

A screenshot of a computer

AI-generated content may be incorrect.

Expand sortCriteria and item[i] which will consists of below two fields:

  1. attribute: enter the name of the field for which you want data to be sorted. Example -firstName
  2. direction: specify the sort direction, either asc for ascending or dsc for descending.
A screen shot of a computer

AI-generated content may be incorrect.

A screenshot of a computer

AI-generated content may be incorrect.

Click on save.

Run the application.

A screenshot of a computer

AI-generated content may be incorrect.

Data is sorted based on firstName in descending order.

We can also add multiple sort criteria as shown below:

A screen shot of a computer

AI-generated content may be incorrect.

Leave a Reply

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

Back To Top