Get a data item from a map
Function: Get a data item from a map
This action allows you to retrieve a specific piece of information from a collection of data, often referred to as a "map" or "dictionary." Think of a map as a list where each item has a unique label (a "Key") that helps you find it quickly. This action is useful when you have a set of related data and you need to extract just one particular value based on its identifier.
Input
- Map (MAP): The collection of data from which you want to retrieve an item. This map contains various pieces of information, each associated with a unique key. If no map is provided, the action will treat it as an empty collection.
- Key (STRING): The unique label or identifier of the specific data item you want to find within the Map. This input is required.
- Data format (DATA_FORMAT): This defines the expected structure or type of the data item you are trying to retrieve. It helps the platform understand what kind of information to expect. This input is required.
Output
- Result (DATA): The specific data item found in the Map that corresponds to the provided Key. If the Key is not found in the Map, the Result will be empty. The structure of this output will match the specified "Data format."
Execution Flow
Real-Life Examples
Example 1: Retrieving a Customer's Email
Imagine you have a temporary record of a customer's details and you need to quickly get their email address.
- Inputs:
- Map:
\{
"customerName": "Alice Smith",
"customerEmail": "[email protected]",
"customerId": "CUST123"
\} - Key:
customerEmail - Data format:
Email Address(a predefined data format for email strings)
- Map:
- Result: The action successfully retrieves "[email protected]" and stores it as
Result.
Example 2: Checking Product Stock Quantity
You have a list of product inventory details and want to find the current stock for a specific product.
- Inputs:
- Map:
\{
"productA_stock": 150,
"productB_stock": 75,
"productC_stock": 200
\} - Key:
productB_stock - Data format:
Number(a predefined data format for integer numbers)
- Map:
- Result: The action retrieves the number
75and stores it asResult.
Example 3: Accessing a Configuration Setting
Your application uses a map to store various system configuration settings, and you need to check if a specific feature is enabled.
- Inputs:
- Map:
\{
"featureX_enabled": true,
"logLevel": "INFO",
"maxUsers": 100
\} - Key:
featureX_enabled - Data format:
Boolean(a predefined data format for true/false values)
- Map:
- Result: The action retrieves the boolean value
trueand stores it asResult.