If we want to use a few of our favorite things in a flow, we can create values representing each of those things. Or.. We can create a type.. and a single list value of that type that holds the entire list.
One of the advantages of creating a type and a list is how fast we can edit the data. Say, we have a production app that lists the insurance policies of 75,000 members. If we need to add a data field, we can just add a new property in the type, instead of editing the 75,000 member data one by one.
- Click LOG IN to log in to the Flow Drawing Tool.
- Create a new Type. Let’s say, Monsters.
- Let’s give our Monsters a few properties.
- What is better than a type called Monsters? A list of the Monsters type! Let’s create it then. Click Values.
- Click New Value.
- What kind of list are we creating? A list of monsters, of course. Copy-paste List of monsters in the Name field.
- Select List as the kind of value. This opens the option for selecting a type of value.
- Click Select a Type.
- Search for and select Monster.
This is what the screen looks like now:
- We know that an instance of a type is an object. And a collection of objects is a list. What we did just now is create an empty list, of the Monster type. We can now save the value, and populate the list at a later time (say, from user input). We can also add default data at this stage. Let’s try that.
- Click the + icon. This expands the options for adding default object data.
- Copy-paste Inverness in the Home town, Ms. Nessie in the Name, 1 in the Number of heads, 4 in the Number of limbs, and 17.29 in the Scariness quotient fields respectively.
- Click the + icon again. This is our second monster object.. Home town – Odenwald, Name – Frankie, Number of heads – 1, Number of limbs – 4, and Scariness quotient – 11.07.
Perhaps you would like to create your own monster object, based on the above template? Go on, create a few objects.
- Click Save Value when done. This saves the List of monsters value.
And we are all set! The list is ready to be used in a flow now.
Here are some other cool things to do:
- Tutorial: Using a combo box
- Tutorial: Using loops to filter list data
- Tutorial: Types with aliens (Episode 1)