MAP_VALUE_STARTS_WITH
Description
Returns the corresponding return_value for the first compare_substring that matches the beginning of the provided string (case-sensitive). If no substrings match, returns default_return_value_optional. If default_return_value_optional is omitted and no matches occur, the function returns $SKIP_ASSIGNMENT.
Syntax
MAP_VALUE_STARTS_WITH(string, ...[compare_substring, return_value], default_return_value_optional) -> Object
Parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
| string | String | Yes | The string to evaluate (case-sensitive). |
| … compare_substring | String | Yes | The substring to match at the beginning of the provided string. |
| … return_value | Object | Yes | The value returned if compare_substring matches. |
| default_return_value_optional | Object | No | The value returned if no substrings match. If omitted and no match occurs, returns $SKIP_ASSIGNMENT. |
Examples
MAP_VALUE_STARTS_WITH("ca-san francisco", "CA", "California", "NY", "New York", "Other")
-- Returns "Other"(case-sensitive).MAP_VALUE_STARTS_WITH(Description, "Platnium", "Partner", "Individual", "Person")
-- Returns "Partner" if Description starts with "Platinum".
-- Returns "Person" if it starts with "Individual".
-- Returns $SKIP_ASSIGNMENT otherwise.
-- Matching is case-sensitive and stops at the first match.Tips
Ensure that return_value and default_return_value_optional are of the same data type.