Hello! I am trying to receive data in my Retool app. The API I am using has 2 endpoints which correspond to 2 control queries. The POST request returns the expected data in both control queries. However, in one of the control queries, the data is returned in rawData but not in data. The other control query contains data in both data and rawData.
In both cases, the data is formatted as follows: [{'key1' : 'value1'}, {'key2' : 'value2}]. Does anyone know why data could be empty in the first control query? More generally, what is the difference between data and rawData in the API response?
Thanks Scott. More context: get_commission_payout is the resource query that returns the API response. When I look at get_commission_payout in the State view, the data variable is empty:
However, the rawData variable has the expected data:
Why is the API response being sent to rawData but not to data? The reason I ask is because the transformer uses data, and I can't seem to get the transformer to use rawData instead.
In the Data source field for a table component you should be able to use: [{{get_commission_payout.data}}] without using a transformer.
Not clear on why data is NOT populated...
Agreed. I am using {{resource_query.data}} from my other resource query and it works like a charm. Now I'm just trying to get the response from get_commission_payout sent to data.
Thanks for reaching out! I think I might know why this is happening If you disable (remove) the transformer, does the query's data property get populated with the expected response?
I have seen a case where the .data is empty, but .rawData has an array of values if the query runs successfully, but the transformer "fails." I have filed a bug for this-- we should be surfacing some error or warning when this happens
For your transformer, you won't want to run formatDataAsArray(data) since the data is already in the proper format.
Thanks Tess! I actually just rebuilt the Retool query and the .data field started populating again. I appreciate your help and hopefully the bug gets resolved soon!