Is it possible for a stepper on one field add a number to that field and another field as well?
What I want is one field to accumulate a number and periodically be set to zero.
In another filed, I want to have the same stepper used above to accumulate, but to never have it set to zero.
So, I would end up with 2 fields, one with an incremental sum and the second with a total of all.
It is obvious I could use 2 steppers, but I know I would forget at times the second stepper and why do the extra work?
You would need to use a Script Field to manage this. The Script Field would monitor the value of your stepper field and add to the value of the second field.
But, if I was able to build a script (which I can’t), could it be activated by the stepper or do I have to go into settings and select the script and run that? That would be more work that activating 2 steppers I would think?
The field script would be triggered by a change in the stepper field.
That is cool.
How about a script to do that? Would be really appreciated.
Something like this should work:
function incrementField() {
var field1_id = 'fld-.....';
var field2_id = 'fld-.....';
var field1_value = record.getFieldValue(field1_id);
var field2_value = record.getFieldValue(field2_id);
record.setFieldValue(field2_id, field2_value + 1);
form.saveAllChanges();
}
incrementField();
You would need to use the appropriate field IDs from your own form.
-
This reply was modified 1 year, 6 months ago by Brendan.
Well, that was interesting. I lost all the data in my “Total” (second field), and anytime I look at the record or recalculate the “Total” increases sometimes by many times.
I should have backed up my data. That was a big failure.
I’m sorry for that. Yes, it’s always important to make backups frequently. Sorry this happened to you.
I didn’t have your document and the script was just off the top of my head and wasn’t tested with your data.