Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 29

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 32

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::load() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 161

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 138

Strict Standards: Non-static method JRequest::clean() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 33

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 463

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 464

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 465

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 466

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 467

Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/environment/request.php on line 468

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 35

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 38

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 39

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::load() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 161

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 138

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 46

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 47

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 50

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 53

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::import() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 54

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/loader.php on line 71

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 57

Strict Standards: Non-static method JLoader::register() should not be called statically in /home/content/19/13966119/html/adivanew/libraries/joomla/import.php on line 58

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/libraries/joomla/session/session.php on line 423

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/libraries/joomla/session/session.php on line 423

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/libraries/joomla/session/session.php on line 426

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/templates/ja_kyanite_ii/libs/ja.template.helper.php on line 119

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/templates/ja_kyanite_ii/libs/mobile_device_detect.php on line 113

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/templates/ja_kyanite_ii/libs/mobile_device_detect.php on line 114

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/templates/ja_kyanite_ii/libs/mobile_device_detect.php on line 113

Warning: Cannot modify header information - headers already sent by (output started at /home/content/19/13966119/html/adivanew/libraries/joomla/import.php:29) in /home/content/19/13966119/html/adivanew/templates/ja_kyanite_ii/libs/mobile_device_detect.php on line 114
Advance BI Publisher Concepts - Sorting in RTF Template
You are here: BI Publisher Advance BI Publisher Concepts - Sorting in RTF Template

Warning: Creating default object from empty value in /home/content/19/13966119/html/adivanew/components/com_k2/models/item.php on line 226

Warning: Creating default object from empty value in /home/content/19/13966119/html/adivanew/components/com_k2/models/item.php on line 614

Advance BI Publisher Concepts - Sorting in RTF Template

Written by  Venkat, Principle Consultant, Adiva consulting
Rate this item
(14 votes)

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:

<?sort:VENDOR_NAME?>

 

 

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:

<?sort:VENDOR_NUMBER;'ascending';data-type='number'?>

 

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:

<xsl:sort select=".//node()[local-name()=P_SORT_BY]" order="ascending" data-type="number"/>

Let's try to decipher the above xsl syntax. The above XSL has three parts – select, order and data-type. While order and data-type are self explanatory, the Xpath in the select actually does the magic. Let's try to understand this XPath in detail. The function node() returns an node. Specifying just node() will return all the nodes in the XML data. In order to filter, square brackets [] are used and the appropriate filter condition are specified inside. The call local-name() returns the name of the node. Therefore, the condition local-name()=P_SORT_BY will return all nodes whose name matches the value specified by P_SORT_BY.

 

The “order” and “data-type” fields can also use xdoxslt functions in them. Thus, if the sort type is known at run time, the following can be used to set the sort type at runtime:

<?xdoxslt:set_variable($_XDOCTX, ’sort_datatype’, value)?>

<xsl:sort select=".//node()[local-name()=P_SORT_BY]" order="ascending" data-type="{xdoxslt:get_variable($_XDOCTX, 'sort_datatype')}"/>

The above sorts by the field whose value is specified by the P_SORT_BY and the sorting type is decided based on the variable sort_datatype. Similarly, the order can also be obtained from a xdoxslt variable.
 

Read 53479 times

1 comment

  • Comment Link Jason_zhang Thursday, 22 November 2012 03:19 posted by Jason_zhang

    When I use the syntax:
    to sort data dynamically, it isn't work. Where to place this syntax, after the loop? and '.// 'means ? Need I change it according to my code.
    Looking forward to your reply.

    Report

Leave a comment

Make sure you enter the (*) required information where indicated.
Basic HTML code is allowed.