Can't use {{ value }} in a loop to reference a value in a previous query

I'm trying to make a workflow that needs HubSpot company data. I have the company IDs for HubSpot from our PostgreSQL database, and I'm trying to follow documentation to reference it in a loop. It always says that value is not defined (see screenshot). Am I missing something? It seems simple in the documentation but it just isn't working for me.

Even if I try running it, it runs but it doesn't use the values from the previous query for HubSpot Company IDs.

Have you tried it? It can be a bit buggy with the types in some of these scenarios. I've seen it a few times, but it works, despite it being red.

Yes, I've encountered that a number of times too, but I have run it. This is the error when i run it:

{"data":null,"error":"TypeError: Cannot read properties of null (reading 'entries') (line 2)"}

Try re-running the previous block (the database call) manually by pressing the "Run" button on it, or on your loop select run with previous blocks, that sounds like you don't have any data loaded in your loop. You can double check that by clicking the "Inputs" tab at the bottom of the loop block, and the first chunk of data should show you the loop variables and their values.

Thank you, that's actually very helpful. And I believe theoretically should work.

But still got an error :confused: inputs look good to me too (see picture).

That looks like it should be working - which error are you getting? Still the reading entries error, or something different? In a few cases I've switched from the GUI version of the loop to the Code one (toggle "mode" at the top). It gives you access to the underlying code. If you can share the error it might help, otherwise could be worth trying it in code mode to see if it's a bug in the way the GUI is structuring your loop.

Thank you for the help. I tried using Code instead of the GUI (without editing the default code there, similar outcome), but I'm not familiar with Javascript enough to know how to edit it for a workaround. I've passed this on to our engineers to find a better solution for what we were trying to build, so all good now.

Really appreciate your help though (particularly, the validation that it should be ideally working when it wasn't, it was really bothering me). :grin: