Passing variable from workflow to query library

Hey I am stuck on how to pass a variable to a query in my query library using a loop block in workflows. I have a query that gets a list of google calendar ids, and then passes that to the loop. The loop will hopefully get events for each calendar id and pass it to a script that we can use for categorizing employees events.


Any ideas on where I am going wrong here?

Any help on this? Seems pretty goofy that if I put the string directly in to define the variable, I get the expected result, but if I put in {{value.calendar_id}} which is the same value, I get an error!


the 2nd picture where your using the variable in the GET url, mine does the same thing and shows an error, but when I actually use the query it works. I think it's just the linter confused because a value isn't set for it yet. I don't think the variable is actually created until either it's initialized or the query is added to an app. putting something where it says "Specify a value", saving, then refreshing the page will make the error go away... just don't forget to delete it and save when you're done.

sorry but, i'm not able to duplicate the workflow error using a loop and {{value}} so I'm really not sure where to start w trying to help you out here:

Thanks for getting back.

I think the issue is how the loop is passing the variables to the query. If I use a WHERE statement in my getCals query (which is passing values to the loop) to return one calendar_id only, the loop passes the variable to my get_events query perfectly.

Might need to do it programmatically

that's just really odd, I wonder if getCals if this is a bug with Retool Database resource queries in general. It's technically a PostgreSQL db, so they could store data as jsonb to try and take advantage of some differences. it's just an out there shot in the dark, there is evidence for and against it (like Query JSON With SQL but then theres the fact that jsonb doesn't preserve object key order), but since this seems to only happen with arrays and queries always return an object this could be a problem w the underlying storage type not being parsed correctly when returned... like when you have 1 char wrong in a JSON string and makes JSON.parse() blowup and error out.

otherwise, the only other thing I can think of right now is how occasionally I'll have a random Block in a workflow that decides it doesn't know about any previously connected blocks/objects including startTrigger.data. the only way I can get these Blocks that decide objects are invisible to stop throwing errors is to delete it and make a new one (or make a new one, copy/paste everything over, then delete the old one). refreshing the page, changing the type of Resource Query, removing the reference, any these with combining saving and refreshing then re-adding startTringger.data references... none of it would make the error go away, only deleting and re-creating the Block. I'm sure you've tried this, but at this point i guess it's worth asking: have you tried deleting the offending block or creating a new workflow (without using duplicate)?