Dynamically mapping integer to string value in table

Hello all,

I am trying to map an integer to a string value in a table column, similar to the post here:

The difference is I would like to do it dynamically. It is a table of clients, and I want to find the originating_lawyer. This is a foreign key and I am using the built in retool database.

Without any mapped value the column returns the integer that is the ID from the lawyer table.

I want to take this integer "1" use it to return the name and avatar link of the correct lawyer from the lawyer table. Then display the name and avatar of the correct lawyer.

Any assistance would be greatly appreciated!.

Thank you,
Michael

If db, what about using a join in your SQL query?

Hi @Michael_Hayworth, can you give more details about your tables and data (or similar for privacy) to imagine the scenario?

Thanks both @matth and @edurmush for the quesitons.

The table looks like this (a snapshot from a table of clients:

Screenshot 2023-10-10 at 8.15.35 PM

originating_lawyer is a foreign key from table 'clients' to a table 'lawyers'.

Instead of displaying 1 (the foreign key) in my UI table I would like to display the lawyers name. Hope that makes some sense.

Thanks
Michael

1 Like

As @matth said, you can use a join on your SQL query. But if they come from separated data sources then you can use lodash's find method like:

If you need more detail how to use them in your situation please let me know.

1 Like