Arrays walkthrough

Review previous walkthrough exercises where simple and complex arrays were used. We’ll review how we found these and how to utilize the information using array functions if necessary.

An image of a Fusion scenario

Arrays walkthrough

Workfront recommends watching the exercise walkthrough video before trying to recreate the exercise in your own environment.

Transcript
The purpose of the next walkthrough exercise, is to return to two scenarios where we already have worked with simple and complex arrays. In the creating and using data structures walkthrough exercise, we use the split array function to get values out of the simple array key.
In our, Creating different paths using routers, where we call the Pokemon and the superhero, APIs, the output for the returned information was a complex array or a combination of arrays, collections and elements or items.
To be successful at following along in the next walkthrough training videos, you’ll want to have both of these scenarios pulled up and ready to run them once again.
To take a look at a simple array, I’m going to return to our, Creating & Using Data Structure scenario. The first thing I’ll do once I’m in the scenario, is rerun it.
After it runs, I’m going to click into the execution inspector on our numeric aggregator and scroll down to the output section.
Here I can see that each bundle produced from parsing our original CSV, has both a Result and a Key. The key is made up of a user email and a date, comma separated.
If you remember when we went through this walkthrough exercise, to create a new CSV using our data structure, we actually had to take that key produced by our numeric aggregator and split the information. We had to use the split array function because that key contained two different elements that we wanted to grab individually. And because of how we parsed our CSV and iterated through the information, you can consider the iterated information from our parsed CSV to be our simple array. It’s simply a list of individual items. Our key however, is a combination of two items, the email and the date. So we have a variable list of emails and dates that we then want to split to get the email out of it for our user ID and the date out of it for our date column. This is an example of a simple array, single individual items. In the next video, we’ll highlight how a complex array will have more of a data structure to it. And it will vary depending on the number of index structures within that array.
To review a complex array, I’ll return to my, Creating different paths using routers scenario. Again, I’ll start by rerunning this scenario so we can see information in our execution inspectors.
Once it finishes running, I’ll go up and click on the execution inspector on our, Get Pokemon API module.
Here we can see that nine operations were run or nine bundles were passed down this path. If I go into one operation and look at the output, I can see that the data itself coming from the Pokemon API is listed as a collection. If I click into that collection, I then can see a structure of arrays or elements and even additional collections.
Expanding the abilities array for the first set of data, I can see that there are two collections and within these two collections there is yet another collection, for the ability and two elements hidden, equals false in slot number one.
If I drill down into the final collection, I can see the name of the URL for each ability for the Pokemon that came with this bundled output. If I get out of this execution inspector and go into the variables after our, Get Pokemon API call, you’ll remember that we mapped over some individual elements or items from the API call. But then we had to use the Map array function to get the ability’s name out of the array, giving us multiple ability names, depending on the number of indexed abilities for each character.
You may have also tried the practice exercise where you had to get the six different stats and the level for each stat into an additional variable.
At that point in the training you may have come into the item list for the data selection, gone into the stats selection and chose the stat name.
When you do this, the stats are an array themselves and the index of that first item, is one. You could have followed that with a parentheses and gotten the base stat for the value for that first stat name and continued to hit return and grabbing the stat name but changing the index number, from one to two.
This would only work if the array had a set of variables you were aware of. But when it’s a variable number of variables, meaning you don’t know how many different stats might be returned, zero to many. This is where iteration comes into play and you can iterate through the stat name and the base stat number and then aggregate that information and put that information into the stat variable. -

Want to learn more? We recommend the following:

Workfront Fusion documentation

recommendation-more-help
c9fbcf61-6d19-481e-a9ab-f54a0ae0ee8a