Ask AI
Skip to main content

Get value of number field

Function: Get value of number field

This action helps you retrieve the number entered by a user into a specific "Number Input Field" on your application's screen. Once retrieved, this number is stored in a variable, making it available for other actions or calculations within your application.

Input

  • UI element: This is the specific "Number Input Field" on your application's screen from which you want to get the value. You must select a UI element that is designed to accept numbers (specifically, a 'number-input-field' type).
  • Answer: This is the name of the variable where the number retrieved from the "UI element" will be stored. By default, this variable will be named NUMBER_FIELD_ANSWER, but you can change it to something more descriptive if you wish. The stored value will be a whole number.

Output

  • Answer: The number retrieved from the selected "UI element" will be stored in the variable you specified. This variable will hold a whole number.

Execution Flow

Real-Life Examples

Example 1: Calculating a total price

  • Scenario: You have an order form where users enter the quantity of an item. You want to get this quantity to calculate the total price.
  • Inputs:
    • UI element: Select the "Quantity" number input field on your order form.
    • Answer: orderedQuantity
  • Result: The number entered by the user in the "Quantity" field (e.g., 5) is stored in a variable named orderedQuantity. You can then use this orderedQuantity variable in another action to multiply it by the item's unit price.

Example 2: Validating user input for age

  • Scenario: You have a registration form where users need to enter their age. You want to retrieve this age to ensure it's a valid number.
  • Inputs:
    • UI element: Select the "Age" number input field on your registration form.
    • Answer: userAge
  • Result: The number entered by the user in the "Age" field (e.g., 25) is stored in a variable named userAge. You can then use this userAge variable in a condition to check if it's within an acceptable range (e.g., greater than 18).

Example 3: Updating a stock level

  • Scenario: In an inventory management application, you have a field where users enter the number of items to add to stock. You need to get this number to update the inventory.
  • Inputs:
    • UI element: Select the "Items to Add" number input field.
    • Answer: itemsToAdd
  • Result: The number entered by the user in the "Items to Add" field (e.g., 100) is stored in a variable named itemsToAdd. This itemsToAdd variable can then be used in a database update action to increase the current stock level for that item.