For Each

Modified on Wed, 22 Jun 2022 at 10:34 AM

For Each

The For Each Component alludes to a for each loop that may be called on arrays. It takes an array and a call and for each item in the array, it will make another call and output the array's index and the item at that index.


This example is more complicated so let's go through what is happening step by step. 

1. We are getting a successful response from our Request to an API

2. The response goes through the Get Values element to parse out an array called "data"

3. Our onSuccess call is triggering a For Each loop over the array of items we just got from the response.

4. For each item in the data array, our Get Values element is parsing out strings called "author", "description" and "title.

5. For each item in the data array, we are making a call that constructs a container and sets the values of three (unseen) text areas within the container that are labeled Author, Description, and Title. These values are pulled from the above step in our Get Values element.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article