Help Setting Select Input (checkbox) Default Value from Mapped Options

I'm trying to select a "Default Value" from a list but i'm struggling to figure out how. I want to preselect the option that corresponds to the selectedrow.

I have 2 datasets to compare.

{{self.values}}
0, 15
1, 16

The first column being the index of the dropdown value. The second column is the id. So self.values[0], selects the first value

The other table I have is the {{order_table.selectedRow.data.id}}
The selected row is returns an id of 15.

How to do create an expression that sets the self.values index to the matching id of 15, which would be [0] in this case?

I see the default is index 0
{{ [self.values[0]] }}

So I perhaps I would do another expression inside the index [ ]? I'm lost.

Thanks!!!

Hey @shutter.drag! Do you mean selectedRow of the table? If so, would something like this work for you?

This grabs the id from the selectedRow and uses it as the default value of the checkbox component. The checkbox component uses the ids as the underlying values and the names as the display values.

See attached app JSON if you want to poke around with my setup! You can import this JSON file by clicking Create new (home page) > From JSON. Quick docs on exporting/importing apps here.


selectedRow-20to-20dropdown.json