Ask AI
Skip to main content

Get values from map

Function: Get values from map

This action allows you to extract all the individual pieces of information (values) from a collection of key-value pairs, presenting them as a simple list. It's useful when you need to process or display all the data stored in a structured collection, without needing to know their specific identifiers (keys).

Input

  • Map: This is the collection of items you want to work with. Each item in this collection has a unique identifier (a "key") and an associated piece of information (a "value").
    • Type: MAP

Output

  • Result: A new list containing all the individual pieces of information (values) that were originally stored in your Map. The order of items in this list might not be guaranteed.
    • Type: ARRAY

Execution Flow

Real-Life Examples

Here are some ways you can use the "Get values from map" action in your applications:

Example 1: Listing all product names from an inventory

Imagine you have a collection of products where each product has a unique ID (the key) and a product name (the value). You want to display a simple list of all product names on your website.

  • Inputs:
    • Map:
      \{
      "PROD001": "Laptop Pro X",
      "PROD002": "Wireless Mouse",
      "PROD003": "USB-C Hub"
      \}
  • Result: The application now has a list containing ["Laptop Pro X", "Wireless Mouse", "USB-C Hub"], which can be displayed to users.

Example 2: Extracting all user preferences

Suppose your application stores user preferences in a collection where the preference name (e.g., "theme", "language") is the key and the chosen setting (e.g., "dark", "English") is the value. You want to see all the settings a user has chosen.

  • Inputs:
    • Map:
      \{
      "theme": "dark",
      "language": "English",
      "notifications": "enabled"
      \}
  • Result: The application now has a list containing ["dark", "English", "enabled"], representing the user's current preference settings.

Example 3: Getting all quantities from an order

Consider an order where each item name (e.g., "T-Shirt", "Jeans") is a key, and the quantity ordered for that item is the value. You need a list of all quantities to calculate total items.

  • Inputs:
    • Map:
      \{
      "T-Shirt": 2,
      "Jeans": 1,
      "Socks": 3
      \}
  • Result: The application now has a list containing [2, 1, 3], which can be used to sum up the total number of items in the order.