Table column 'Tag' data type and mapped options

Hey Friends! :wave:

I'd be grateful for some assistance with my limited JavaScript knowledge, please.

I have a workflow returning a pandas dataframe where my 'Matches' column returns 3 of the closest matches from a lookup list, against the value in the 'Name' column.

Table1 shows the 'Matches' column as a String data type and so you see 3 suggested matches, with scores, as nested arrays.
I am trying to achieve something like Table2 whereby the 'Matches' column offers the 3 suggested names only as tags for the user to select the most appropriate name.

Here's what I'm trying out for expressions...


result:

or


result (which is almost there!):

Is what I'm trying to achieve doable with mapped options for tags, or am I best off doing the wrangling back in the workflow?

Any pointers greatly appreciated and thanks for dropping by :+1:
Ben

1 Like

Hi @mrben Unfortunately this isn't currently supported by the Tags or Tag column type. The Tags and Tag column types only allows for a single selection of options that will be available for every row in the table. It's not possible to configure distinct options for each row. BUT, I've let our Engineering team know that you'd like to this capability from Retool and will let you know if they make this change down the road!

For now, my suggestion would be to enable expandable rows on your table component and use a dropdown component in the row expansion. Could that work for your use case?

Here's a lightweight example:

Dummy dataset populating the table

{
  id: [1, 2],
  name: ["B", "F"],
  options: [
    [["A", 1, 2],["B", 3, 4],["C", 5, 6]], 
    [["D", 10, 20],["E", 30, 40],["F", 50, 60]]
  ]
}

Enabled expandable rows on the table

Add a Select component to the expanded row and set the select component Data source with the array from the corresponding index of the table data (using the i variable)

{{ distinct_options.data.options[i].map(x => x[0]) }}

1 Like

Hi Everett,

Thanks for your reply and the expandable row suggestion. I had contemplated that as an approach to return suggestions to the user... and I can certainly see it fitting with other use-cases. Appreciate the example :pray:

For this particular solution I'm now leaning toward a 3 tag visual for reference and another tag column for selection / custom inputs.

:+1:

1 Like

Hello @everett_smith !

Is this feature of having different tag values for each row being developed or will be developed on future?

thanks!

1 Like

Hi @davidr! I assume it's something you'd be interested in seeing? Quite a bit of work related to the table component, including this, is currently in the backlog but I'll bump it on your behalf. :+1:

We'll provide an update here as soon as we can!

2 Likes

Hi @Darren, Just liked to chime in that I'm also interested in the development of this feature. Thanks to the team for all their hard work!

1 Like

Thanks for letting us know, @Fayyazul_Hassan! And welcome back to the community. :slightly_smiling_face: