Possible bug: Data getting looped even when it's not in a loop

I built a function for Michael G. at Tongo that gets data from Yelp, reformats the data, and creates/edits a record. A couple days ago, he reached out saying it was no longer working.

I had a look, and it appears that some steps are being treated like they’re in a loop even though they’re not. Here’s what I’m seeing:

This is the function stack:

At the end, I create a variable and populate it with a single piece of data from the Yelp api: The venue’s name.

You can see from this API output that I formatted it correctly:

But when I run it, it says the variable is an array of blank values:
It appears to have created a blank value for each day the company is open (each time we looped the schedule reformatting).

Here’s where it gets really funky: If I move that step of creating the variable up to the top before the looping, then it works just fine!

For the time being, I’m just going to create variables for each property right at the top of the stack, and I’ll reference those variables when I create the new record at the very end. However, this is super weird and I’m sure it will trip us up eventually, so I wanted to let y’all know.

Thanks Erin - we will check it out.

So it looks like there is a bug with the GET filter and the For Each Loop

We can get around this by using just dot notation on the variable:

Additionally, we noticed a way to optimize the day of the week calculation in two lines versus all the conditionals, the conditional is commented out (hidden) for the time being.

But first, we create an object with key-value pairs of the number and day of the week. Then using the variable day.day as the dynamic path of that variable in the loop we are able to retrieve the day of the week.

Ooh, nice tip on the schedule section. Thanks.

For the looped section, the api call won’t always include all of the pieces of data, so I still have to use “get” instead of dot notation so I can have it default to null when necessary.

Nonetheless, I can still use my original workaround idea: I can create variables from the api data before the loop and reference those variables (rather than referencing the api output after the loops.

Gotcha, we will fix the GET filter bug. But at least there are a couple viable workarounds in the meantime. Should be coming soon!

Hi @ErinHWagner we just pushed an update with the fix for this included. You should be able to use the GET filter without the issue of the loop affecting anything outside it.

Confirmed–this works again. Thank you!

1 Like