The Polarion BetterSort extension allows you to sort collections of work items by any attribute, including Polarion custom fields. 

This is an evolution of the SortTool from the „Wiki Scripting Tools“ extension.

Features

  • Sorts collections by Polarion custom fields
  • Sorts the Polarion id field by number 
  • Provides split() functionality
  • Designed for LiveDocs and -Reports (also backward compatible with classic wiki)

Installation

Unzip the contents of the „ch.processworks.polarion.tools.zip“ file into your „Polarion/polarion/extensions“ folder. Restart Polarion.

Usage

A typical use case for the BetterSort tool is in advanced reporting, when you get linked items via getLinkedWorkItems() and want to sort the resulting list by work item id.

You access the functionality through the  $betterSort variable in LiveReports and classic wiki.

Example:

## sort work items by id
#set ($linkedItems = $master.getLinkedWorkItems())
#set ($sorted = $betterSort.sort($linkedItems, "id")

To sort by multiple fields specify the fields as an array:
#set ($linkedItems = $master.getLinkedWorkItems())
#set ($fields = [ "id",  "owner", "sortOrder:desc"])
#set ($sorted = $betterSort.sort($linkedItems, $fields)

The „:desc“ prefix after a field name reverses the sort order.

Documentation

BetterSort is based on the Apache Velocity Collection Tool; find it’s full documentation at https://github.com/apache/velocity-tools/blob/master/velocity-tools-generic/src/main/java/org/apache/velocity/tools/generic/CollectionTool.java

Limitations 

The current version of the BetterSort tool does not dive into work items. That means for example, that you cannot sort a list of „LinkedWorkItemStruct“ by specifying  a field in the format „linkedWorkItemStruct.linkedItem.id“.

Polarion: Sort work items by any attribute
Markiert in:     

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.