How to populate multiple variables on a data card based on a certain selection
This article will help you set up a data card that has multiple variables defined using a drop-down selection. This is an incredibly useful option to use when you need to list a lot of values on the data card based on a previous selection. This method is commonly used when you want to prevent users from choosing the incorrect options while modifying the file. Setting it up can be confusing at first, but once you get the hang of it, it’s another tool in the belt.
For example:
The data card needs to list specific processes that need to be followed when a certain manufacturing method is chosen. In this example, there are 5 processes that needs to be displayed on the card:
Processes 1 - 5 need to be updated based on what main process is chosen at the top. This main process is based on a drop-down list:
Selection 1:
Selection 2:
The steps in the setup are as follows:
1. Create a list using the Text With Alias data type.
2. Create the appropriate variables the aliases are going to be assigned to.
3. Link the drop-down list to the Text With Alias list.
4. Use Input Formulas to populate the selected variables.
Step 1: Create a list using the Text With Alias data type.
In your Administration tool, you’ll have a node called Lists. Expand the node, right-click on the Card Lists node, and select New List. You will have to define a Displayed Value with an Alias attached. The Displayed Value is the value that you choose on the drop-down list. The Alias is the value that is going to be populated to the other variables.
In the Alias box, you can specify multiple values connected to that Displayed Value. For all the Displayed values shown, there are going to be 3 processes that need to be followed/displayed on the data card i.e. Process 1, Process 2, and Process 3. We are going to do this by adding the pipe (|) symbol between the different values to separate them:
- Create a new list and name it PROCESSES. Select the Text With Alias data type and click the Save icon in the top left corner.
- Create a displayed value for a BUY IN ITEM and the appropriate aliases. We are going to input 3 values/aliases to populate the 3 processes that need to be followed for a BUY IN ITEM. Seeing as it is bought, there are going to be no processes that need to be followed, hence why we are going to assign “N/A” to the 3 values. These values need to be split into 3 processes by using the pipe (|) symbol i.e. N/A|N/A|N/A|. Insert values for a MADE IN HOUSE displayed value as shown below:
Step 2: Create the appropriate variables the aliases are going to be assigned to.
Now that we have a list of the Displayed Values and the 3 aliases linked to them, we need to create variables that are going to be assigned the alias values:
We’ll need a main variable to hold the Displayed Value, and a variable for each of the aliases. Create the 4 variables as shown below:
Step 3: Link the drop-down list and edit boxes to the Text With Alias list.
On your data card you’ll need to have a drop-down list to select the process you need and have the 3 aliases populate. We’ll do this by adding a Combo box Drop list control for the displayed value, as well as 3 normal edit boxes (text boxes) for the aliases as shown below:
Start with the drop-down list:
Select the drop-down list and go to the properties pane on the right. Select Special value under Items and select the PROCESSES list we created earlier. Select the PROCESSES variable we created in the previous step for Variable name.
This will now list the Displayed Values from that list. i.e. BUY IN ITEM and MADE IN HOUSE.
Let’s link the appropriate process variables to the edit boxes by selecting them, going to the properties pane, and selecting the process variable from the Variable Name drop-down:
Your card should now look similar to this:
All that’s left to do is to use the Input Formulas to display the aliases where the process variables are.
Step 4: Use Input Formulas to populate the selected variables.
When selecting an edit box, you’ll see on the very bottom of the properties pane that there is an Input formula section. This is where we can specify what alias must be show when a specific display value has been chosen. Input formulas are incredibly powerful and will be discussed in another article. For this one, I’ll explain why we’re using the specific formula.
The formula we are going to use looks like this:
Where:
- PROCESSES is the variable to look at. You can add it by clicking on the arrow symbol to the right and selecting the variable from the list.
- 1 is the value to take from the aliases. In this case we want the PROCESS 1 variable to display the 1st value from all the aliases.
| is the symbol it needs to use to split the value. The above formula states that it must use the 1st value it can find to the left of the pipe symbol (splitting symbol).
In short, the formula states that it has to look at the PROCESSES variable, match the Displayed Value of the list to the aliases, and use the 1st alias value to the left of the first pipe symbol (|).
Create the input formulas for the remaining 2 processes. These would use the 2nd and 3rd values from the aliases respectively.
Process 1:
Process 2:
Process 3:
Now you should be able to save and test the data card on the appropriate files.
To test:
In your Local View, select the file, select the BUY IN ITEM from the drop-down list we created, and see how the values of the other processes get filled in automatically. The same will happen to the MADE IN HOUSE process.
Date: 24/07/2024