Shipping Director Setting - Sort Expression

Shipping Director introduced a Sort Expression in version 1.07.  The sort expression should evaluate to a string that represents an 'ordering clause'.  The ordering clause is one or more (comma separated) shipping option fields: Rate, Name, Description.  Each field can optionally be followed by ASC or DESC (the default is ASC = Ascending).   

Examples (Don't forget, it's a string Expression, so it's typically enclosed in double quotes):
"Rate ASC" 
"Name DESC" 

Example using ternary if-then-else  - If the cart weight <= 150, then sort by Rate, otherwise use the default sort. (The default is used when the expression results in blank string):
[$TotalWeight] <= 150 ? "Rate ASC" : "" 

In this example, we'd like to sort by Rate, but we want the "Pick up ..." option at the end, so sort by Name "prefix" then Rate:

"Name.SubstringBefore("" ""), Rate" 

FedEx Ground ($15.23) 
FedEx Express Saver ($51.51) 
FedEx Standard Overnight ($88.95) 
FedEx Priority Overnight ($108.35) 
Pick up at our warehouse ($0.00) 

UPDATE 2020-09-17  More example sort expressions:

Explicit sort of names (using ' ? : '  if-then-else operator):  

"Name = ""Ground"" ? 1 : Name = ""Priority"" ? 2 : Name = ""Special"" ? 3 : 4"

Tags :  1.07Sort
Comments
Leave your comment
:
sample@email.tst
Created on: 6/26/2023 5:32 PM
1