Case

 

 

 

Case

 

Description

Evaluates a list of conditions and returns on of multiple possible result expressions.

 

Arguments

1.Case - Name of the Macro.

2.Input - Value to test for matches.

3.WHEN - A constant value that indicates that the next parameter is the value to match against

4.match-expression - A value to compare against Input to determine if there is a match

5.THEN - A constant value that indicates that the next parameter is the value to return if the previous parameter was a match.

6.result-expression - A value to return if a match was detected

7.ELSE - (Optional) A constant value that indicates the next parameter is the value to return as no matches were made

8.default-expression - (Optional) A value to return if no match was made - only provide this value is ELSE is used.

 

Arguments 3 through 6 may be repeated as many times as are necessary.

 

Examples

[CASE|[DateFormat||MM]|WHEN|01|THEN|January|WHEN|12|THEN|December|ELSE|Neither]

Returns the word January in the first month, the word December in the 12th month, and Neither for any other month.

 

[CASE|[DateFormat||MM]|WHEN|01|THEN|January|WHEN|12|THEN|December]

Returns the word January in the first month, the word December in the 12th month, and no value for any other month.

 

Notes

There is no limit to the number of WHEN-expression-THEN-expression clauses that you include in the macro.  However, if there will be a significant number of value consider using the Lookup macro instead.

 


Copyright © 2024 pasUNITY, Inc.

 

Send comments on this topic.



Created with an evaluation copy of HelpSmith.
To remove this notice, you should purchase the full version of the product.