I've queried some data from one resource (Salesforce) and transformed the data so that it contains an array of values. I now need to query some data from a different resource based on the values I have received from Salesforce.
I've tried something like this:
SELECT * FROM myTable WHERE fieldName IN UNNEST({{arrayTransformer.Value}}) but I'm getting a Syntax error message saying unexpected comma
Any ideas what I'm doing wrong or how I can achieve what I need to?
Unfortunately not, those docs help if I'm manually setting the array within the query but don't mention how I can add a variable (transformer value) into the where clause
Ah, actually, those examples should work for dynamically passed in arrays! You’d just replace [1,2,3] with your transformer.value
select
*
from
users
where id IN UNNEST({{ arrayTransformer.value }})
Should work but I know that’s what you had originally and it was throwing the comma error. What is your arrayTransformer.value? A screenshot of the value expanded out in the left panel’s State tab would be super helpful!
So I have managed to get something working although it does seem like a dodgy workaround. I've basically assigned all the values from the data I pulled into one long string within the transformer and then filtered via array using '.split'
SELECT * FROM myTable WHERE fieldName IN UNNEST([{{transformer2.value.split(',')}}])
However I think using just the array would be the better approach. The value of my array before I updated the transformer was like this: