Choose

Returns the value after the then of the first condition that returns true.

If all conditions return false, then the value after default is returned.

Don't forget the end keyword.

All values after each then and default keyword must be of the same type to be returned.

Syntax
/*basic syntax : */
choose
    when boolean_condition1 then value1
    when boolean_condition2 then value2
    when boolean_condition3 then value3
    when boolean_condition4 then value4
    when boolean_condition5 then value5
    default value
end

/*Example: */
choose
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 1 Then "Monday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 2 Then "Tuesday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 3 Then "Wednesday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 4 Then "Thursday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 5 Then "Friday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 6 Then "Saturday"
    when DayOfWeek ([Webshop.Orders.OrderDate]) = 7 Then "Sunday"
    default "Day of the week"
end

Last updated

Was this helpful?