Store SUM of input values from a repeat

Hi all

I have a repeater which shows on the page a number of rows. Each row has an input field and I’ve given them a name and id like this:

dmx-bind:id="inp_hoursRate[$index]" name="hoursRate[]" type="number"

I want to store the sum of these into a variable and I thought it would be easy but am now struggling to work out how!

Any help or pointers would be very much appreciated.

If your inputs don’t have a static id then use their name in the expression below:

repeat1.items.sum('hoursRate.value')

if they have a static id replace the hoursRate with it. And of course change repeat1 to whatever your repeat is called :slight_smile:

dmx.app.data can reapply be your best friend in such cases

Screenshot 2022-01-25 at 19.19.18

2 Likes

Brilliant. Thanks @Teodor, that was exactly the steer I needed. Works perfectly.