Map Value
📌 Definition
The "Map Value" action in Zenphi is designed to transform or convert an input value into a new output value based on a set of user-defined matching conditions (cases). This is particularly useful when you want to simplify decision-making, standardize values, or assign corresponding labels or codes based on input.
You define a series of "Cases" — each containing a specific Input and the corresponding Output to return if there's a match. If none of the defined cases match the input value, a Default Value is returned instead (if specified).
🔑 Key Capabilities:
- Flexible value mapping based on exact matching logic.
- Supports fallback using a Default Value.
- Returns both the result and an indicator showing whether a match was found.
- Great for replacing or normalizing values without using complex conditional branches.
Example Use Cases
1. Normalize Form Responses
Convert various user inputs into standard valuesWhen users submit different variations like "yes", "Yes", "YES", or "y", you can map them all to a standardized value like "true"
.
2. Department Code Mapping
Convert department names to internal codesMap user-selected department names like "Finance"
or "Marketing"
to corresponding internal codes such as "FIN"
or "MKT"
for backend processing.
3. Status Label Translation
Display user-friendly labelsIf your system stores status as "1"
, "2"
, or "3"
, you can map these to "New"
, "In Progress"
, and "Completed"
respectively to show more meaningful information to end users.
4. Localize Country Names
Match country codes to full namesTake an input like "DE"
and map it to "Germany"
for use in localized communications or documents.
5. Fallback for Invalid Entries
Return default when no match is foundIf an unexpected value is entered (e.g., "Unknown"
), return a default like "Not recognized"
or "N/A"
to handle edge cases gracefully.
🧾 Inputs
1. Input value
*(Please enter the value you wish to look up within.
)*This is the actual value that will be evaluated against the defined cases. The action will check if this input matches any of the case values provided.
Example: If you enter "CA"
as the input value, the action will search for a matching case like "CA"
and return the mapped output (e.g., "California"
).
2. Cases
*(Matched values to map the value - each case has an Input value and Output value.
)*This is where you define the possible input-output mappings. Each case acts like a rule:
- Input value: The value to match against the main input.
- Output value: The value to return when the input matches this case.
You can add as many cases as needed to create a comprehensive map.Example:
- Input:
"US"
→ Output:"United States"
- Input:
"UK"
→ Output:"United Kingdom"
3. Default value
*(If no match is found, return this value instead
)*This value will be returned when the input doesn’t match any of the specified cases. It’s useful for handling unknown or unexpected inputs without breaking your flow.
Example: If the input is "XYZ"
and no matching case is found, the default value (e.g., "Unknown Country"
) will be returned.
📤 Outputs
1. Result
*(The final mapped value based on the input and defined cases.
)*This is the main output of the action. It returns the mapped value from your defined cases if the input matches any of them. If no match is found, it returns the Default Value instead (if provided).
Example:
- Input:
"FR"
- Case:
"FR"
→"France"
- Result:
"France"
If"FR"
had no matching case, it would return the default value (e.g.,"Unknown"
).
2. Found match
*(Indicates whether a match was found for the input value in the list of cases.
)*This is a boolean value (true
or false
) that tells you whether the input matched any of the specified cases.
true
: A case matched the input value.false
: No matching case was found, and the Default Value was used.Example: If your input is"JP"
and there is a case"JP" → "Japan"
, then:- Found match:
true
If the input is"XYZ"
with no matching case, then: - Found match:
false
📌 Example Scenario
Automatically translating country codes to country names in a form submission
Imagine you're building an automated process where users submit a form that includes a country code (e.g., US
, FR
, DE
). However, you need to convert these codes to full country names for your internal database or for sending customized emails.
Here’s how you would use the Map Value action:
-
Input value: Use the country code submitted via the form (e.g.,
FR
). -
Cases:
US
→United States
FR
→France
DE
→Germany
-
Default value:
Unknown Country
(in case the submitted code isn’t in your list)
If the form sends FR
, the Result will be France
and Found match will be true
.If someone submits JP
, and it's not in the list, the Result will be Unknown Country
and Found match will be false
.
This makes your flow smarter and more user-friendly by dynamically mapping codes to clear values.
Updated about 17 hours ago