I'm sorry I didn't include more info, but I made the changes you suggested. Nothing seems to be happening with the scripts, and no attributes are being updated. Can I get a log of what the scipt is doing to figure out where the error is? Is there something wrong with the order of operations perhaps? This is what I've got now. I have included two versions of bar for testing. <fieldset class="repeating_foo">
<input type="checkbox" name="attr_ob1" value="1"/>
<input type="checkbox" name="attr_ob2" value="1"/>
<input type="checkbox" name="attr_ob3" value="1"/>
<input type="checkbox" name="attr_ob4" value="1"/>
<input type="number" name="attr_barshow" value="@{ob1}+@{ob2}+@{ob3}+@{ob4}" disabled="true"/>
<input type="hidden" name="attr_bar1" value="[[@{ob1}+@{ob2}+@{ob3}+@{ob4}]]"/> <input type="number" name="attr_bar2" value="0" readonly />
<hr/>
</fieldset>
<input type="hidden" name="attr_barmax1" value="0"/>
<input type="number" name="attr_barmax1show" value="@{barmax}" disabled="true"/>
<input type="number" name="attr_barmax2" value="0" readonly /> on("change:repeating_foo:ob1 change:repeating_foo:ob2 change:repeating_foo:ob3 change:repeating_foo:ob4", function() { getAttrs(["repeating_foo_ob1", "repeating_foo_ob2", "repeating_foo_ob3", "repeating_foo_ob4"], function(v) { setAttrs({ "repeating_foo_bar1": parseInt("v.repeating_foo_ob1",10)||0 + parseInt("v.repeating_foo_ob2",10)||0 + parseInt("v.repeating_foo_ob3",10)||0 + parseInt("v.repeating_foo_ob4",10)||0 }); }); }); on("change:repeating_foo:ob1 change:repeating_foo:ob2 change:repeating_foo:ob3 change:repeating_foo:ob4", function() { getAttrs(["repeating_foo_ob1", "repeating_foo_ob2", "repeating_foo_ob3", "repeating_foo_ob4"], function(v) { setAttrs({ "repeating_foo_bar2": parseInt("v.repeating_foo_ob1",10)||0 + parseInt("v.repeating_foo_ob2",10)||0 + parseInt("v.repeating_foo_ob3",10)||0 + parseInt("v.repeating_foo_ob4",10)||0 }); }); }); on("change:repeating_foo remove:repeating_foo", function (eventInto) { getSectionIDs("repeating_foo", (idArray) => { // Constructs an array containing attribute names for all rows const sourceAttrs = idArray.map(id => `repeating_foo_${id}_bar1`); getAttrs(sourceAttrs, (values) => { // constructs an array containg attribute values for all rows const rowValues = sourceAttrs.map(attr => parseInt(values[attr], 10) || 0); const numberOfRows = idArray.length; const maxOfRows = Math.max(...rowValues); const minOfRows = Math.min(...rowValues); const sumOfRows = rowValues.reduce((m, x) => m + x, 0); let avgOfRows = Math.round(sumOfRows / numberOfRows); // Do more stuff with these values setAttrs({ barmax1: maxOfRows, barmin1: minOfRows, baravg1: avgOfRows }); }); }); }); on("change:repeating_foo remove:repeating_foo", function (eventInto) { getSectionIDs("repeating_foo", (idArray) => { // Constructs an array containing attribute names for all rows const sourceAttrs = idArray.map(id => `repeating_foo_${id}_bar2`); getAttrs(sourceAttrs, (values) => { // constructs an array containg attribute values for all rows const rowValues = sourceAttrs.map(attr => parseInt(values[attr], 10) || 0); const numberOfRows = idArray.length; const maxOfRows = Math.max(...rowValues); const minOfRows = Math.min(...rowValues); const sumOfRows = rowValues.reduce((m, x) => m + x, 0); let avgOfRows = Math.round(sumOfRows / numberOfRows); // Do more stuff with these values setAttrs({ barmax2: maxOfRows, barmin2: minOfRows, baravg2: avgOfRows }); }); }); });