Hi there, I'm just another Retool user and no js expert but a couple of things - by applying map to a simple array (which is what your getProducts.data looks like), it's then mapping all of the individual characters in the array items. If you look you can see it's not random, it's just splitting the letters into individual columns (A-u-g---2-1 etc.)
On the first bit -hard to say - but you don't need to use the 'getProducts' bit if you're in a query transformer, you can use the reserved word data, per the example code in the transformer field:
Also likely that if you do change the transformer, you would need to re-run the query I imagine.
Other than that hard to say as getProducts.data seems to be referring to different things in the transformer, and in your second fragment. What are you trying to do?
And use "Save and run" Retool changes valuer of getProducts.data to the outcome of transformer. Thats why another run operates on a different getProducts.data then original
That doesn't happen if you use click "preview" instead of "save and run" and it doesn't happen if yo use data instead of {{getProducts.data}} .
So not sure if it's a bug or a feature
Can't really imagine a scenario when this is useful so I think that could be a good idea if Retool resets the value of the query to default (as it would be without transformer) before it runs transformer after you click "save and run". Maybe it's not a bug, but would be much simpler.
Just wanted to narrow down outcome of the query to one column, remove duplicates and blank entries so I can use it in a select. Achieved now by creating separate transformer.
I actually always use a separate transformer. I find that the code can get lost in the query transformer, you need to remember it's there; whereas if a table uses a separate js transformer as it's input then that's really traceable. The other benefit is that, when debugging, you can compare the data that comes straight out of the query with the transformer. As a non-js-expert, it's normally my transformer code that's broken
There's some useful syntax using formatDataAsObject to return a single 'column' from a query in this post which I came across recently