Skip to main content
Skip table of contents

Prevent Fields from Sorting Alphabetically

Users can sort a field after they add it to a table. For a field in the rows, clicking the sort button next to the field name sorts alphabetically based on the labels. For example:

Initially the Area field is unsorted:

The first click sorts in ascending alphabetical order:

The second click sorts in descending alphabetical order:

In some cases it does not make sense to allow a field to be sorted into alphabetical order.

For example, you might have a date field containing months. It would not make sense to sort this alphabetically:

If you have fields in your data where this is the case, you can configure SuperWEB2 not to allow alphabetical sorting on these fields. Users will only be able to sort the field into the original order that was defined in the classification table when the SXV4 was built.

For example, if this configuration is applied to the Customer Open Month field:

The first click sorts in ascending classification order:

 

The second click sorts in descending classification order:

Prevent a Field from Sorting Alphabetically

This restriction is configured in SuperADMIN. Before starting to configure this setting, use the following command to check whether any current restrictions are defined:

CODE
cfg db <dataset_id> superweb2.rules.valueSetItemIndexOrders

Replace <dataset_id> with the ID of the dataset you are setting rules for. SuperADMIN will either display a list of existing restrictions (if some are already defined), or display "not found".

Scenario A: No Existing Restrictions Defined

If there are no existing sorting restrictions defined, SuperADMIN displays the message "not found":

CODE
> cfg db bank superweb2.rules.valueSetItemIndexOrders
superweb2.rules.valueSetItemIndexOrders : not found

To prevent a field from sorting alphabetically, use the following command:

CODE
cfg db <dataset_id> superweb2.rules.valueSetItemIndexOrders[<index>].field set <field_id>

Where:

  • <dataset_id> is the ID of the dataset this rule applies to.
  • <index> is the index for this restriction. Each restriction has a unique index number, starting from zero.
  • <field_id> is the ID of the field this restriction applies to. Use the command cat <dataset_id> <field_name> to find a field's ID.

For example, the following commands apply the sorting restriction to the Gender, Customer Open Date, and Customer Open Month fields on the bank dataset:

CODE
cfg db bank superweb2.rules.valueSetItemIndexOrders[0].field set "SXV4__Retail_Banking__F_Customer__Gender_FLD"
cfg db bank superweb2.rules.valueSetItemIndexOrders[1].field set "SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Cal_FLD"
cfg db bank superweb2.rules.valueSetItemIndexOrders[2].field set "SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Month_FLD"

Scenario B: Existing Restrictions Defined

If there are already some sorting restrictions set for specific fields, then SuperADMIN displays the details. For example:

CODE
> cfg db bank superweb2.rules.valueSetItemIndexOrders
superweb2.rules.valueSetItemIndexOrders :
[
    {
        "field":"SXV4__Retail_Banking__F_Customer__Gender_FLD"
    },
    {
        "field":"SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Cal_FLD"
    },
    {
        "field":"SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Month_FLD"
    }
]
>

In this case there are three fields with sorting restrictions already defined. You can add a new restriction or update one of the existing ones:

  • To add a new sorting restriction for a different field, simply make sure that you use the next index value up. In this example there are already three rules, so to create a fourth you must use the index value of 3 (because the index numbering starts at 0). For example:

    CODE
    > cfg db bank superweb2.rules.valueSetItemIndexOrders[3].field set "SXV4__Retail_Banking__F_Account__Acc_Open_Date_Month_FLD"
  • To update an existing sorting restriction, simply use the same index value as the existing restriction. For example to replace the restriction for Gender with a different field, use the index value 0:

    CODE
    > cfg db bank superweb2.rules.valueSetItemIndexOrders[0].field set "SXV4__Retail_Banking__F_Account__Last_Transaction_Date_Cal_FLD"

Configure a Field to Sort Automatically into Ascending Classification Order

You can also optionally configure a field that has the sorting restriction to automatically sort into ascending classification order by default when it is added to a table.

To do this, add the autoSort setting to the configuration, and set its value to true:

CODE
cfg db <dataset_id> superweb2.rules.valueSetItemIndexOrders[<index>].autoSort set true

For example, suppose this is the current configuration:

CODE
> cfg db bank superweb2.rules.valueSetItemIndexOrders
superweb2.rules.valueSetItemIndexOrders :
[
    {
        "field":"SXV4__Retail_Banking__F_Account__Last_Transaction_Date_Cal_FLD"
    },
    {
        "field":"SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Cal_FLD"
    },
    {
        "field":"SXV4__Retail_Banking__F_Customer__Cust_Open_Date_Month_FLD"
    },
    {
        "field":"SXV4__Retail_Banking__F_Account__Acc_Open_Date_Month_FLD"
    }
]

If you wanted to configure automatic sorting on the Customer Open Calendar Date field (the second one in the configuration), you would use the following command:

CODE
> cfg db bank superweb2.rules.valueSetItemIndexOrders[1].autoSort set true
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.