I have a google data sheet query see below
I also have a MySQL query see below
I am trying to join the data from both queries so I can display in a table the result of the join. I chose to write a js code to join them (see below).
The issue is that all data from stock query is coming back undefined. Let me emphasize that there is data in stock for that sku
Hi @technopath Thanks for reaching out!
If you look on the state tab, you'll see that sheets queries return data formatted as an array of objects by default:
But SQL queries return data as an object with arrays.
formatDataAsArray(), instead of
Object.values() to get the sql data formatted properly. Line 6 would read
const stockArray = formatDataAsArray(stock.data); Also, you can likely remove Object.values from subArray on line 3.
Another option, in case anyone is working on a similar issue, is to use Retool's Query JSON with SQL query type to do a sql style join. In this case, you still need to use
formatDataAsArray() if any of your data is formatted as an object with arrays.