# Advance BI Publisher Concepts - Sorting in RTF Template

I am sharing a nice article on RTF template design written by one of our senior consultant Mr. Venkat from Adiva Consulting.

The objective of this post is to explain the “sorting” capabilities available in the RTF. Many might

already be aware of the standard BI Publisher syntax for sorting in the RTF template:

The above construct sorts the data by the VENDOR_NAME in ascending order – an alphabetic sort

is performed. However, what if the requirement was to sort on a number field. For example, if you

want to sort by the VENDOR_NUMBER, then the above will produce incorrect results as an

aphabetic sort would be applied to a numeric field. The following BIP construct can be used to

specifc the order and the sort type:

The above BIP construct performs a numeric sort on the vendor_number. That's rather simple to do.

Let's say we would like to sort on a field but the field name is not known at design time. The field

name exists in the xml data. Let's say the element P_SORT_BY specifies the field on which sorting

must be done. So, if the value of P_SORT_BY is VENDOR_NAME, sorting must be performed on

the field VENDOR_NAME. This can be acheived by using the following XSL:

- AshishRaj's blog
- Login to post comments