Skip to main content
Participant
October 3, 2023
Answered

Custom Calculation Script not calculating

  • October 3, 2023
  • 1 reply
  • 814 views

I am trying to make a subtotal field in which overtime pay can be automatically calulated using current pay. However, the script I wrote in does not seem to calculate anything. 

With O/T pay being 1.5x of normal pay, below is the Custom calculation I wrote. Disclamer, I am very new to this. 

 

var nA = Number(this.getField("Hourly Pay").value);
var nB = Number(this.getField("Hourly Weeks").value);
var nC = Number(this.gedField("Hourly OT Hour").value);

var nResult = (nA * 1.5) * nB * nC;

event.value = nResult;

 

 

Any help would be greatly appreciated. 

This topic has been closed for replies.
Correct answer try67

In the third line replace gedField with getField...

1 reply

try67
Community Expert
Community Expert
October 3, 2023

Script looks fine. Check the JS Console (Ctrl+J) for error messages.
If there are none there share the file for further help.

Participant
October 3, 2023

Thanks @try67

 

I did get the following error codes. 

 

TypeError: f is null
1282:byteCodeTool
TypeError: this.gedField is not a function
3:Field:Calculate
TypeError: f is null
1282:byteCodeTool
TypeError: this.gedField is not a function
4:Field:Calculate

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
October 3, 2023

In the third line replace gedField with getField...