Tag-type table column labels breaking on option value change

tldr; The labels in my mapped, tag-type table column are not holding up when the column's data is modified by an external query

I have a table with four columns describing an electrical connection

  • source_asset_id
  • source_side_ocp_id
  • target_side_ocp_id
  • target_asset_id

The user defines the source and target assets, from a list of all available assets. Then, based on what they select for source_asset_id, they can choose from a list of available options for source_side_ocp_id. Same on the target side.

source_asset_id and target_asset_id are set up as tag fields with the following mapped options:

{{ Object.values(activeData.value.asset_id_map) }}

Which produces an array like this:

[
  {
    "asset_name": "FL-6-DISCO",
    "asset_id": "5f87881f-43cb-401e-b4f7-bc6ea692d5c9"
  },
  {
    "asset_name": "FL-6-PP",
    "asset_id": "a2d7132c-5883-41e5-96be-8d97c742b274"
  }
]

The value of the column is set to item.asset_id, and the label of the column is set to item.asset_name.

Then, we define the source_side_ocp_id and target_side_ocp_id columns somewhat similarly:

Data Source:

{{ 
  activeData.value.asset_subcomponent_map?.[currentRow.source_asset_id]
    ?.filter(sub => sub.subcomponent_position === "Load Side")
  ?? []
}}

This is all well and good, and it works well at first. However, the second that I make any change which modifies the results of the above data source query (for example, if I switch one of the subcomponent_position values to "Line Side"), then the labels cease to be found, and I'm left only with a list of unintelligible ID's to select from

Before:

Change:

After:

Just a thought, I may be wrong, but I don't think I'd have used currentRow in that Tag mapping query, because it's different (obviously) for each row and you are expecting the query to run numerous times, once for each row. Can it actually do that?

1 Like