Ask AI
Skip to main content

Get previous step

Function: Get previous step

This function helps you navigate through a "Stepper" UI element by finding the step that comes right before the one currently displayed. It's useful for creating "Back" buttons or managing multi-step processes in your application.

Input

  • Stepper ui element: This is the visual "Stepper" component on your page. You need to select the specific Stepper you want to interact with. This input is required.

Output

  • Result: This is where the function will store the unique identifier (code) of the previous step. You can choose a name for this variable, and its default name is "PREVIOUS_STEP". The output will be a number.

Execution Flow

Real-Life Examples

Here are some examples of how you can use the "Get previous step" function:

Example 1: Implementing a "Back" button in a multi-step form

Imagine you have an application form divided into several steps using a Stepper component. You want to allow users to go back to the previous step.

  • Inputs:
    • Stepper ui element: MyApplicationFormStepper (the name of your Stepper component)
  • Result: The function will store the numerical code of the step before the current one (e.g., 1 if the current step is 2) into a variable named PREVIOUS_STEP. You can then use this variable to set the Stepper to that specific step.

Example 2: Conditional logic based on previous progress

You might want to perform a specific action only if the user has completed a certain previous step.

  • Inputs:
    • Stepper ui element: OnboardingProcessStepper
  • Result: If the user is currently on "Step 3", the function might return 2 (the code for "Step 2") and store it in PREVIOUS_STEP. You could then use a condition like "If PREVIOUS_STEP is 2, then show a specific message."

Example 3: Logging user navigation for analytics

You want to track the sequence of steps a user takes in a complex workflow.

  • Inputs:
    • Stepper ui element: ComplexWorkflowStepper
  • Result: When a user moves from "Step 5" to "Step 6", and you trigger this function, it will store 5 (the code for "Step 5") in PREVIOUS_STEP. You can then log this PREVIOUS_STEP value along with the current step to understand user paths.