I’m using the MealDB API. However, the correct number of ingredients just won’t appear. Sometimes, I see the same ingredient repeated 20 times, with the ingredients starting at 1 and increasing by one with each DVL display. Other times, every single display has 22 ingredients, which isn’t correct.
Here’s my code;
I figured out the issue but can’t think of any way to rectify it. So basically I had created a list with all the letters of the alphabet. I wanted to loop through those letters and put them one-by-one into the search MealDB by first letter API. I’m not sure for the j loop probably is asynchronous or something and looping through 26 letters and then calling an API 26 times was probably too much for the app. When I tried searching only by letter a, I was able to see all the ingredients and names properly. When I tried searching by a then b (just 2 letters), the app mixed them all up and then wasn’t able to find the correct number of ingredients. Any suggestions?
I would say that you need a variable that you set to null with every start of the main loop and in the create row block set the variable to the row id returned by the block. In your loop you need a wait loop to check that the control variable is not null which means the create row operation is completed.
I hope you get what I mean because I was just brain dumping.