Expression source

This is an example of how to use dependent fields and source show the the End-user different controls in the user step based on what has previously been selected.

Ensure that Allow Dependencies is set to true for the user step. The user step must allow dependencies for this functionality to work properly.

Create an App with steps and input data

  1. Create a new Application in an Application package and open it in the Designer.

  2. Add a User step in the App.

  3. Add a Script step and connect it to the User step with a data arrow.

  4. Add the following script to the Script step and set its target variable to electronics.

    return [
        {name: "Laptops", category: "Electronics"}, 
        {name: "Monitors", category: "Electronics"}, 
        {name: "Printers", category: "Electronics"}
        ];
  5. Add a new Script step and connect it to the User step with a data arrow.

  6. Add the following script to the newly created Script step and set its target variable to furniture.

    return [
        {name: "Desks", category: "Furniture"}, 
        {name: "Chairs", category: "Furniture"}, 
        {name: "Cabinets", category: "Furniture"}
        ];
  7. Add a new Script step and connect it to the User step with a data arrow.

  8. Add the following script to the newly created Script step and set its target variable to apparel.

    return [
        {name: "Shirts", category: "Apparel"}, 
        {name: "Pants", category: "Apparel"}, 
        {name: "Jackets", category: "Apparel"}
        ];

Create and connect controls

  • Check the Allow Dependencies checkbox in the User step General section.

  • Create a Text Input control in the user step.

    1. Set the Prompt to What are you looking for?

    2. Set the Target Variable to be product.

  • Create a List Selection in the user step.

    1. Set the Prompt to Choose specific item.

    2. Set the Source to be an expression and set the expression to be the following

      {apparel & furniture & electronics where name like ("%" & product & "%") or category like ("%" & product & "%")}
    3. Set the Large Row Text to be {name}.

    4. Set the Inline option to Open

Test the user step with where filtering

  1. Save the Application.

  2. Start the Application in any client.

  3. You can now see that options in the List selection contain all nine items that were provided in the script steps.

  4. Type Electronics in the Text input.

    1. As you type you can see that the options in the List selection below are limited to only electronics.

  5. Type Jacket in the Text input.

    1. As you type you can see that the options in the List Selection below are limited to only Jackets.

Test the user step with a case expression

  1. Open the Application in the designer.

  2. Open the user step and select the list selection

  3. Change the source expression to the following

    {case when "Electronic" like ("%" & product & "%") then electronics when "Furniture" like ("%" & product & "%") then furniture else apparel end }
  4. Save the Application.

  5. Start the Application in any client.

  6. You can now see that options are limited to only Electronics

  7. Type Furniture

    1. As you type you can see that the options in the List selection below are limited to only furniture.

Last updated