For each item j and web API problem

Does Web API not work the same in a for each item j?

I’m expecting the results to be 30, 31, and 91 but it always either
30, 30, 30
31, 31, 31
91, 91, 91

Here’s a screenshot of the blocks & a link to the project

1 Like

The Web API Get is an asynchronous block which means it will allow the next block to be processed before if completes its work.

Move the in list ....... insert at last as ........ inside the Get block so that data is only added once the process is completed.

1 Like

@muneer is right. Think of it this way:

You’re telling Thunkable: “Get info from a server (API). Add a variable’s value to a list.” Thunkable is going to begin the API call and then immediately add the “empty list” value of that variable to the list. An API call can take several seconds to complete. So to insure that you are adding the correct value to the list, you need to – as @muneer suggested – move that “in list” block inside the “then do” section which only runs after the API call is processed.

1 Like