Skip to main content
This topic has been closed for replies.
Correct answer quirky_Glow157F

paste this into the custom calculation script:

event.value = Math.round((Number(this.getField("A").value) + Number(this.getField("B").value))*16)/16;

You may want to set your format to Number, 4 decimals.

A longer javascript line that can also be pasted into the custom calculation script is:

this.getField("C").setAction('Calculate', "event.value = Math.round((Number(this.getField(\"A\").value) + Number(this.getField(\"B\").value))*16)/16;" );

3 replies

Participant
October 10, 2017

worked like a charm. Thank you.

quirky_Glow157FCorrect answer
Participating Frequently
October 7, 2017

paste this into the custom calculation script:

event.value = Math.round((Number(this.getField("A").value) + Number(this.getField("B").value))*16)/16;

You may want to set your format to Number, 4 decimals.

A longer javascript line that can also be pasted into the custom calculation script is:

this.getField("C").setAction('Calculate', "event.value = Math.round((Number(this.getField(\"A\").value) + Number(this.getField(\"B\").value))*16)/16;" );

Inspiring
October 7, 2017

How do you want the output to appear? For example, for a result of 3.1875, do you want that or "3 3/16", or something else?

Participant
October 10, 2017

Decimals would be great, please.