How to reference an input inside a repeat from outside the repeat

I have a form with inputs that are inside a repeat and have id’s like the following:
id="insp_OrderID" dmx-bind:id="insp_OrderID_{{$index}}"

And I have a var that captures the value of the index that the user clicks on like:
dmx-on:click="varOrderDetailsIndex.setValue($index)"

Now, outside the repeat, I have a button with an onclick that needs to check the value of the OrderID for the given index. When I use the builder to select the field, I get this:
modal_orders.form_orders.tableRepeat_OrderDetails[0].insp_OrderID.value

I tried replacing the 0 with the variable value like:
modal_orders.form_orders.tableRepeat_OrderDetails[varOrderDetailsIndex.value].insp_OrderID.value
But it doesn’t work. Any ideas how to go about this?

Community Page
Last updated: