Custom Calculation Script Help
So I'm attempting to create a custom calculation script and running into kind of an infinite loop, and JS really isn't my forte. Script is as follows.
//Value Check
var v1 = this.getField("Adjust To").value;
var v2 = this.getField("Account Balance").value;
//Calculation
if (v1=="")event.value="";
else {
event.value=v1-v2
}
This script works fine at what I want it to do, which is to take entry from the "Adjust to" Column, subtract it by a the "Account Balance", and then place the result (positive or negative) in the "Adjustment" Column. The issue I run into however, is if I try to mirror this approach in the "Adjust to" Column. Using the same script in both fields but changing the Adjust to script to show the sum of the value of "Adjustment" and "Account Balance" seems to result in a somewhat infinite loop. As entering in either box runs both scripts and ivalidates the intended calculation. In an ideal world, I would really only want each script to run if and ONLY if you manually type data into one field or the other. I'm not sure if theres really a conditional you could input that only enables a script when user data is entered vs calculation data, however I've exhausted every resource I could find. Any input would be appreciated .
Here is a flowchart of what the pdf both will vaguely look like and highlights the intended functions

