Hi! I'm entirely new to this...and have hit a problem with the very first thing I've tried. I'm querying for some JSON (see below) via an API, which is returning what I'm asking for OK. However, when I view it within a table, it's putting the entire content of the returned line within a single column called 'GAZETTEER_ENTRY'. I can see why it's doing this, but how do I tell it that I really want 'ID', 'Name' and 'Type' to be the three separate column headers? Can I change the code in the Data block to request this? It's currently set at {{ myquery.data.results}}, but adding '.GAZETTEER_ENTRY' to the end of that string (which was my guess at solving it) didn't seem to work. Any ideas, please?
I took your JSON and added it to a temp state as a test and then used a table component and added the value as [{{state2.value.results['0'].GAZETTEER_ENTRY}}]. Note here that I put [ and ] around that to make it an array...
@GuyHeathcote - happy to help
If you are running a query or an API that pulls that data in you can just take that resource name and replace "state2" so you don't have to use the temp state and populate the table directly....please mark as solution above so other people can find it. Best of luck
You would need to use JS to manipulate your data to get the items you need within this nested field.
Here is a sample code that takes in your value, use Map to retrieve the values within "fields"
let x = {{ state1.value.records }}
let y = x.map(element => ({"id": element.id, "createdTime" : element.createdTime, "name": element.fields.name,"email": element.fields.email }))
return y
Please be gentle, I just started learning retool.
I just tried your solution. How come that the retool transformer fails and says "x.map is not a function". Do I miss something here?
EDIT: I just figured it out. Seems so I was not passing my tempState data as an array. Bracketing [] my data solved the error message.