Sort and format Forward Path reports

Aug 14, 2017

This topic provides information about how you can control the sort order of the Forward Path report and the formatting of the application data.

Sort the application list

You can sort the application list in the Forward Path report based on the data in any of the columns. For example, you can sort the applications by their name, manufacturer, RAG status, or the values in any of the other columns.

You set the sort order using the Settings object, which is available throughout the scenario. The Settings object is of type ForwardPathReportSettings. If you look in the Property Explorer (on the right side of the Forward Path Logic Editor) you will see the properties on this object.

Typically you set the sort order in the Initialize() function. For example, the following sorts the applications by the values in the RAG column:

``` pre codeblock Public Overrides Sub Initialize()

’ Sort the report on the RAG column. Settings.ApplicationSortBy = “Rag”

End Sub


By default, the sort is in ascending order (lowest to highest value). For RAG values, this is green, amber, red. To reverse this (to red, amber, green), add another line like this:

``` pre codeblock
Settings.ApplicationSortDescending = true

In a grouped report, you can set the sort order of the groups like this:

``` pre codeblock Settings.GroupSortBy = “Cost”


By default, this sorts the groups on the values in the group Cost column in ascending order. You can change it to descending order, like this:

``` pre codeblock
Settings.GroupSortDescending = true

Note: Conventions for sorting data vary from culture to culture. By default, the conventions defined by the user’s regional settings are used. However, you can override this using the Culture property as explained below.

Format the column data

The following properties enable you to format report columns:

  • Format – Use this to specify how you want the data formatted. For example, you can specify that numeric data is to be formatted as a percentage value or as a currency. You specify the formatting using a standard composite formatting string (only the zero index item can be used). We provide more information and examples below.
  • Culture – By default the user’s regional decimal separator and currency symbol is used when formatting currency and decimal values. However, if you are working in an international environment, this can mean that the currency symbol will vary according to the locale settings on the end user’s device. You can use the Culture property to override the default behavior (so that, for example, the currency symbol does not change depending on the regional settings of the device on which the report is being viewed). You specify the culture using a combination of the ISO 639 two-letter lowercase culture code associated with a language and the ISO 3166 two-letter uppercase subculture code associated with a country or region. For example, if you want to use the United States dollar symbol, you would specify the value as en-US. More information and examples follow.

The following screenshot of the Property Explorer highlights these properties for the standard Cost column and the first CustomField column. Notice that you find these properties for the standard columns (such as the Outcome, Rag, Cost, and Description columns) under the Display node. Whereas for the CustomField columns, the properties are under the CustomField itself.

Note: By default, the Cost column is formatted as currency.

Set the Format property

You specify the formatting using a standard composite formatting string (only the zero index item can be used). For example, you can format a column as a percentage, like this:

``` pre codeblock result.CustomField1.Format = “{0:P}”


This multiplies the numeric value stored in the column by 100 and converts it to a string that represents a percentage in the output. For example, the value 0.05 is rendered as 5.00 % when the report is run in the UK using the default UK culture setting.

You can format a column as a currency value, like this:

``` pre codeblock
result.CustomField1.Format = "{0:C}"

This displays the numeric value with two decimal places and the currency symbol. By default the currency symbol is taken from the user’s regional settings – for example, £75.00 using the UK regional settings. You can override this using the Culture property.

Set the Culture property

You specify the culture using a combination of the ISO 639 two-letter lowercase culture code associated with a language and the ISO 3166 two-letter uppercase subculture code associated with a country or region (such as en-US for United States English).

For example, you can set the Culture property to Japanese like this:

``` pre codeblock result.CustomField1.Culture = “ja-JP”


If the column is a currency, it will have the Yen currency symbol.

You can set the culture to Spanish, like this:

``` pre codeblock
result.CustomField1.Culture = "es-ES"