Array in RetoolDB

Hello All,

I have a RetoolDB table and one of the columns contains an array. I have an app with a table displaying the RetoolDB Table but I want a certain column to display data from inside the array but it doesn't display at all.

Here is my RetoolDB Table:

Here is my query for the RetoolDB:

Here is my table:

When I have the mapped value as {{item}} then it displays the entire array but if I put {{item.address1}} or any other nested item, then it doesn't display anything.

Not sure what I am doing wrong or if I need to transform the data first?

Thank you all!

HI there @Miotx,

This is happening because your column is a text type, and as such the information in your column is a string, and not and array.

A simple solution is to change your mapped value to {{ JSON.parse(item).address1}}

In alternative, you can either:

  1. Change your column type to JSON so that when you query that column it returns it as an array, rather than a string
  2. Format it as an array within your query

Hope this helps!


Thanks @MiguelOrtiz , {{ JSON.parse(item)}} worked like a charm!!

1 Like

One last question.. lets say I have a simple text component and I want to display the address based on the table row that is selected... I tried {{ JSON.parse(data).table1.selectedRow.address1}} but it didn't work. How would you go about displaying the parsed data from the array?

Thanks again!

I think you need to parse the value in the name_address field of the selected row:
{{ JSON.parse(table1.selectedRow.name_address).address1}}


You rock @jg80 !