Table tag dynamic mapped options based on row data

I have a table with dozens of rows and each row relating to a specific client. There may be multiple rows for a given client.

I have a tag field where I want the options to be mapped dynamically based on the selected row such that only relevant options for that client are shown.

At the moment I have a transformer doing this based on the selectedRow but of course as you deselect that row the tags disappear.

Is there a way to do this?

Thanks!

Is it possible for you to share more details and/or a screenshot?

@Alex_Chapman,

You might need to make a new query that holds the client<->tag values and use this to map to the options in your tag column with a filter on the selected row's client id.

I'm doing something like that already, although might be approaching it the wrong way

Tag options configuration:

image

Transformer:

image

The result of this is that to see the set tag, you have to have the row selected:

image

Thanks!

Can you also show us what the setup looks like for the Invoice column?

I can tell by the transformer that you are forcing the data to come from the selected row to filter the invoices but you should be seeing the column value separately from the options list if they are coming from different sources.

Here's the value settings:

image

Oh, do you have the Allow Custom Values option disabled in the Options list setup?

image

This could explain the behavior of seeing a value only when selecting a row from the table.

I also have an example where the data source for my options list is conditional based upon a selected row which you could probably use to link to the array of invoices tied to that customer row. My example is based on the modulus result of the selected row:

Table values are randomly generated with the same logic (modulus values determine the randomly assigned value from the same conditions of the data source) and when I am looking to change a specific row, I am only shown the possible values from the arrays I setup:

image
image

YMMV but you should be able to source the results of your customer invoices in a similar way.

Ok good spot! That has stopped the selection from disappearing as I select
different rows.

The issue now is that I am writing the invoice_id to the db (set as the
value field of the tag), but the label (invoice_name) is lost unless the
row is selected so it can't determine the label...

Any ideas how to get around that bit? It's not the end of the world because
it's just an internal admin app so as long as someone can see that
something is set against it, that's the most important thing. But would be
nice to see the name.

The invoice_name field should be unique so I could just save that as the
value to be honest.

image.png

1 Like

I think just using the invoice_num as the value instead of the label would clear up the display and, since they are supposed to be unique, could be used to reference against another invoice-keyed table.

I had a similar issue with a select dropdown -- when using the value I wouldn't get the name to display properly -- but then I switched the Label to be a Caption and it worked. Unfortunately there is no caption for the Tag component in a table.

That's all working nicely now @pyrrho

Appreciate you taking the time to help - thanks!

1 Like