This was the sheet worker that works for the one section: on('change:repeating_body:severity remove:repeating_body', function(eventInfo) { // create a holding object to save attributes const output = {}; // initialise an array to track the severity values. This assumes severities have values of 1-5 let severities = Array(6).fill(0); // an array for the minumum pont on the wound track each wound size must mark. const sevmins = [0, 1, 5, 8, 10, 12]; getSectionIDs('repeating_body', idarray => { const fields = []; idarray.forEach(id => fields.push(`repeating_body_${id}_severity`)); getAttrs(fields, values => { idarray.forEach(id => { const sev = parseInt(values[`repeating_body_${id}_severity`]) || 0; if(sev==0){ removeRepeatingRow('repeating_body_' + id); } else { if ([1, 2, 3, 4, 5].includes(sev)) { severities[sev] = severities[sev] +1; } else { // if a severity is outside the valid range of 1-5, add it to severities[0] = severities[0] +1; } } }); // a function to find the first eligible 0 value in the body track const findNextEmptyWound = (arr, start) => arr.indexOf('0', start); // a complex function to build a bodytrack of 0-12 with values 0 or 1. // I would normally explain how this function works, but lets just say its magic. // reduce is an extremely powerful function, but not easy to explain. const bodytrack = severities.reduce((arr, size, index) => { if (index === 0) return arr; for(let i = 0; i < size; i++) { const nextEmpty = findNextEmptyWound(arr, sevmins[index]); if(nextEmpty > 0) arr[nextEmpty] = '1'; } return arr; }, Array(13).fill('0')); // now that we know which points on bodytrack are 1 and which 0, save them to output. bodytrack.forEach((check, index) => { if(index > 0) { // set the body track value to 0 or 1. output[`body${index}`] = check; } }); const getWoundMod = (wounds, woundBands) => { // this will give the largest entry that has a marked wound, and 0 if no wounds. const biggestWound = wounds.lastIndexOf('1') === -1 ? 0 : wounds.lastIndexOf('1'); // this will find which wound band that wound falls into const whichBand = 5-woundBands.reverse().findIndex(index => biggestWound >= index); return -whichBand; }; output['body-mod'] = getWoundMod(bodytrack, sevmins); setAttrs(output); }); }); }); I had thought that if I changed the "health1" "health2", etc fields to "body1", "body2", etc., and changed the "repeating_wounds" section to "repeating_body" I could then have a "repeating_mind" section with "mind1", "mind2" etc., and a "repeating_psyche" with "psyche1" and so on and then be able to run it all through a single script, but all I did was get it to stop working altogether.