Oh, I didn’t know items was available in the repeat like that. Thank you! That works great.
To get it back to a numeric value, I’m using this expression:
{{tableRepeat_OrderDetails.items.sum(`inp_Amount.value.replace('$','').replace(',','').toNumber()`).formatCurrency('$', '.', ',', 2)}}
So, theoretically I don’t need the Array component any more, except that I need to be able to add new rows and that was the only way I could figure out how to do it. I’m wondering if there is a way to add them directly to the repeat? Is there an add method or equivalent on that object? If there was, I could base the repeat on the Data Detail component and eliminate the Array.
Also, one little detail I’m trying to work through is for deleting rows that are already in the database. The concept is that those rows will have an OrderID value and the delete button inserts a ‘D’ in front of that value and the server connect deletes those from the database when it sees that D. But the calculation will have to filter those out in the total. The UI has: dmx-hide="inp_OrderID.value.substr(0,1) == 'D'"
so deleted rows are hidden.
To handle those, I changed the Total calculation to:
{{tableRepeat_OrderDetails.items.sum(`(inp_OrderID.value.substr(0,1) != 'D' ? inp_Amount.value.replace('$','').replace(',','').toNumber() : 0)`).formatCurrency('$', '.', ',', 2)}}
And that seems to work, but is that the right way to go about it? Or is there a better way to ‘filter’ out certain values?