If you just want to populate or initialize your declared array with values manually, you can use Set Expression editor. The expression will vary depending
on what type of array you are mapping to. Below are some samples. Note: If you are trying to map a value from another array to your existing array,
skip this topic and check Mapping Arrays Using Iterate Step that comes after.
When mapping an array of primitive type or strings, you can initialize its values like so:
Ninja Tip: Open the content assist by pressing control+space* on MacOS and type 'dsl' which will give you a Gloop Model DSL template you
can use to assign or initialize values to an element of your array.
If you want to initialize your array of Gloop Models with multiple values, you can enter a new line, without and separator or delimiter like so.
in your Gloop Service Editor, open up content assist by pressing dot(.) key and type iterate over. A suggestion will appear and it's the one we want.
Once selected, the content assist will guide you through the setup like asking what's the input and output array. The input and output arrays
just basically where the values will be coming from, and where the values will be mapped respectively. For this example, we will be using words
as the input array and mappedWords as the output array
The resulting step would be of the one below:
The next step would be mapping the values from words to mappedWords. We can do this by adding a new Map Step as a child step of the
The service at this point should look like this:
You will notice that the words and mappedWords doesn't look like an array anymore, instead they are now what you think it is, just a string. This
is because arrays inside an Iterate Step are treated as single entries rather than array itself. We have two array of words as an input and output
and so we are given two single entry instance of those arrays. With this, we are now ready to process each values from the input array and add it
to our output array (which is represented by a green arrow that goes left to right. This means words is dragged-and-dropped over mappedWords)
You can also use the same approach for dynamically populating your Gloop Model array.
When configuring an iterate over step, you'll notice a property called Append that accepts values true or false. Setting the value to true will not
overwrite the existing values on the Output Array if any, while setting the value to false will do the opposite..
*Depending on your OS, shortcut will vary. If you are using a different OS, look for the equivalent key. Also depending on the context, you can also
use dot(.) key to open the content assist feature.
Did you find it helpful?