Lists
This article shows you how to use the List blocks in our Dynamic Engine.
Last updated
This article shows you how to use the List blocks in our Dynamic Engine.
Last updated
There are twelve list blocks you can use in the Dynamic Engine. This article focuses on the three most common blocks you will use:
Create List With
Make List From Text
In List Get
The create list with block assigns a list of values to your variable. This allows you to group items together while also maintaining their independence from one another.
For example, this sets the value of the variable named "List of Colors" to "Red,Blue,Green,Yellow". The colors are separated by a comma when stored in the Dynamic Engine.
The make list from text block does the same thing as the create list with block. It works great when you have a really large list that you want to add to the Dynamic Engine because it saves time by not having to drag and drop blocks. For example, this sets the value of the variable named "List of Colors" to "Red,Blue,Green,Yellow" (same as above).
The colors are separated by a comma when stored in the Dynamic Engine. The most common delimiter that people use with computers is a comma. We blew our intern's mind when we showed them that .csv files from excel stands for Comma Separated Values. 🤯
There are no spaces when using the delimiter, unless you specify the delimiter to have a space.
The in list get block pulls a value out of the list. This is useful when you want to pull a random value from a list. For example, this sets the value of the variable named "Random Color" to either "Red", "Blue", "Green", or "Yellow".
The way this works is we first want to create a list. In this case, the list is called "List of Colors". Then, we want to create a new variable called "Random Color" that uses the in list get block from, and specify that we want a random value from the list. The options for the get dropdown are:
Get - retrieves a value from the list, leaving the list unchanged
Get and Remove - retrieves a value from the list, removes it and updates the list
Remove - removes a value from the list and updates the list
For example, the following blocks could result in the variable "Random Color" being "Green" and the list becoming "Red,Blue,Yellow".
The options for the # dropdown are:
# - retrieves a value from a specific position in the list (e.g., the 2nd value would be "Blue")
# from end - retrieves a value from a specific position in the list, counting from the end
First - retrieves the first value in the list
Last - retrieves the last value in the list
Random - retrieves a random value in the list
Consider the following multiple-choice question.
The goal of this question is to add a custom list of long-term assets and current assets.
Here is what the Dynamic Engine would look like:
In this example, we use the create list with block to generate a list of values and the in list get block to assign a random value to the variable "Long-term-Asset". Then, we use the get and remove feature to pull values for "Current Asset 1" and "Current Asset 2" based on the "List of Current Assets".
Here is what the sample question would look like (values highlighted in blue for convenience):