Custom Dynamic sort in Bi Publisher

Issue faced by someone on forum

The data source can't be changed.
You got the data as xml, and you want to specify the data sorting.
Not in alphabetical order or numerical order, some arbitrary sort on particular column.

We are make use of sort and decode and convert the element into number and get in sorted order.

Looks possible and simple, but, one big hurdle over there, cannot use xsl 2.0, have to keep it simple.

Here comes the handy "boolean to number conversion".

We can make use of this here.
Have a look at the snapshot.


Look at the xml, status field is unsorted there.
Expected output as follows.
Status: Open
Status: Unresolveable
Status: Closed


<?sort: (number(status='Open') * 1) + (number(status='Unresolveable') * 2) + (number(status='Closed') * 3);'ascending';data-type='number'?>


Use the above sort.

Comments

Archna said…
This is working only till 5. For example if status are 1. In-progess, Open, Pending, Assigned, Closed. and it should be in the order as given above. But if there is one more status added to it the above mentioned way doesn't work. Do you have another way of doing dynamic sort?

Popular posts from this blog

BIP Formatting

Repeat Table Header in all pages in BIP

Limit rows per page