Adding a new column the table which runs another query using the respective row values

I have a table that consists of name, salary from a snowflake resource query(tabledata). I wanted to add another column to that table which should take the value of the name of respective row and should run a big query using the name like
select age from bq_table where name='the name of respective row'. Is it possible in retool. If yes, can anyone help!

Hello!

This is definitely something that can be done, but not quite in the way you are describing. You can add the values you are looking for to the custom column, but you're likely going to need either a separate query that grabs the bq_table and then uses that data to match the values using a javascript function like .find

If that might be too much data to parse and you would like to only call upon the current row via an interaction event you could create a button or row action that opens a modal that executes the query to return relevant data for the current row's "name" property in your bq_table query and displays it there as sort of an additional context card.

If you absolutely just need the table to already show the "age" property from the bq_table then the first suggestion is probably more what you are looking for.

ETA:
Another (and much simpler/more straightforward) approach would be to do a join on the table data you need in an overall query that populates the table.

Hi @pyrrho
Thanks! The first approach is good. Can you please provide me few more details how can we do it with the .find function in js.
Thanks!!