While developing a workflow, there is a very common scenario where we want to calculate the length of an array. That is needed to determine, for example, how many times a loop should be executed.
In this article, let us see how to calculate the array length in Studio Pro.
We can calculate the length of an array using the length property. To do that, follow these steps:
1. Having the array in your canvas, add the Assign value to variable activity
2. Set the variable name as you wish. In this example, it is "array_size"
3. Set the "Variable value" parameter as "Calculate a value"
4. Add the
variable name + .length command. In our example, it must be
As you can see, the resulting variable has the length of the processed array.