Start a new topic

Custom Sort Options

Hi All,


I am looking for options to apply a custom sort based on 3 different Attributes values, am expecting the sort to work as expected, like first sort on Attribute 1 ASC,  then Attribute B DESC and then Attribute C DESC.


The sort condition is like mentioned below,

CASE  WHEN Attribute A= 'A' then 0

WHEN Attribute A = 'B' then 1

else 2

END

ASC,

Attribute B DESC,

Attribute C DESC


Could some help and share thoughts if the above custom condition can be applied on a transition in a business view or any other option to get this achieved in Semarchy. Appreciate your suggestions.


Thanks

Vinoth

1 Comment

How to Implement Custom Multi-Attribute Sort

• SemQL supports SQL-like ORDER BY expressions, including CASE statements and multi-column sorts6.

• You can define this custom sort in the Sort Expression property of a business view, collection, or reference picker.

• The SemQL syntax for your requirement would look like:

 

CASE 
  WHEN AttributeA = 'A' THEN 0
  WHEN AttributeA = 'B' THEN 1
  ELSE 2
END ASC,
AttributeB DESC,
AttributeC DESC

 This will sort first by your custom logic on AttributeA, then by AttributeB descending, then by AttributeC descending.

Where to Apply

• In a Business View: Go to the view’s configuration, enable Customized Sort, and enter your sort expression in the Sort Expression field4.

• In a Stepper or Reference Picker: Under the collection or picker configuration, enable Customized Sort and provide the SemQL sort expression5.

• In a Transition: If the transition displays a collection, you can also apply the sort expression there.



Login to post a comment