I would like to get an array of objects. Currently I’m using this transformer:
const data = {{ l_queryStatusFiltered.data }}
return formatDataAsArray(data)
Everything is working fine so far. Issue is though that I have two code snippets and as these things multiply rapidly I’m trying to cut down on some of them asap.
That’s unfortunately a global query. The only way I’ve found to use additionalScope using local data on a global query is to use a JS query in between.
From my understanding I can’t call a global DB query from a local DB query.
I also can’t add a transformer to a JS query and formatting the return doesn’t seem to work.
I’m wondering if this is an async issue that was introduced when you moved from the triggered query feeding the transformer. In the first case you are transforming the already returned data property but in the updated code you are triggering and then returning data from your constant.
JS inherently doesn’t stop to wait for triggered functions to return so it could be the timing of the script causing the empty data.
After the trigger, you can use a .then() to format/set the return value which should let you at least log some values to debug. You can also try to await the return of the triggered function.