Copy link to clipboard
Copied
I have the formula below in a pdf and am not getting any syntax errors with it but it doesn't appear to be applying the correct number in the multiplication portion. If I add an if else to if(C>.7499 + (D = 36)){event.value = A*.02778+B}; then I receive a syntax error on that line. Any help is appreciated.
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("QualifyingPercentage").value; // the value of field C;
var D = this.getField("SelectTerm").value; // the value of field D;
event.value = "";
if(C<.7500 + (D = 36)){event.value = A*.03235+B};
if(C>.7499 + (D = 36)){event.value = A*.02778+B};
if(C<.7500 + (D = 48)){event.value = A*.02377+B};
if(C>.7499 + (D = 48)){event.value = A*.02291+B};
if(C<.7500 + (D = 60)){event.value = A*.01925+B};
if(C>.7499 + (D = 60)){event.value = A*.01897+B}
Copy link to clipboard
Copied
Can you elaborate a little bit more what are you trying to achive and can you share an example of a screen shot ?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
See if the totals in my slide are correct:
This is what worked for me:
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("QualifyingPercentage").value; // the value of field C;
var D = this.getField("SelectTerm").value; // the value of field D;
event.value = "";
if(C<.7500){event.value = (A*.03235+B)*((C+D)/D)};
if(C>.7499){event.value = (A*.02778+B)*((C+D)/D)};
if(C<.7500){event.value = (A*.02377+B)*((C+D)/D)};
if(C>.7499){event.value = (A*.02291+B)*((C+D)/D)};
if(C<.7500){event.value = (A*.01925+B)*((C+D)/D)};
if(C>.7499){event.value = (A*.01897+B)*((C+D)/D)};
Copy link to clipboard
Copied
Copy link to clipboard
Copied
And this is the calculated payment script with term of months applied (in the slide example 36 month term was applied)
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("QualifyingPercentage").value; // the value of field C;
var D = this.getField("SelectTerm").value; // the value of field D;
event.value = "";
if(C<.7500){event.value = (A*.03235+B)*(D+C)};
if(C>.7499){event.value = (A*.02778+B)*(D+C)};
if(C<.7500){event.value = (A*.02377+B)*(D+C)};
if(C>.7499){event.value = (A*.02291+B)*(D+C)};
if(C<.7500){event.value = (A*.01925+B)*(D+C)};
if(C>.7499){event.value = (A*.01897+B)*(D+C)};
Copy link to clipboard
Copied
Apologies, I made a mistake.
This is the script to calculate payment per month:
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("QualifyingPercentage").value; // the value of field C;
var D = this.getField("SelectTerm").value; // the value of field D;
event.value = "";
if(C<.7500){event.value = Math.abs(A*.03235+B)*((C*D)/D)};
if(C>.7499){event.value = Math.abs(A*.02778+B)*((C*D)/D)};
if(C<.7500){event.value = Math.abs(A*.02377+B)*((C*D)/D)};
if(C>.7499){event.value = Math.abs(A*.02291+B)*((C*D)/D)};
if(C<.7500){event.value = Math.abs(A*.01925+B)*((C*D)/D)};
if(C>.7499){event.value = Math.abs(A*.01897+B)*((C*D)/D)};
And this is the script for the Total applying the months terms:
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("QualifyingPercentage").value; // the value of field C;
var D = this.getField("SelectTerm").value; // the value of field D;
event.value = "";
if(C<.7500){event.value = ((A*.03235+B)*(D))*C};
if(C>.7499){event.value = ((A*.02778+B)*(D))*C};
if(C<.7500){event.value = ((A*.02377+B)*(D))*C};
if(C>.7499){event.value = ((A*.02291+B)*(D))*C};
if(C<.7500){event.value = ((A*.01925+B)*(D))*C};
if(C>.7499){event.value = ((A*.01897+B)*(D))*C};
Please see if it sorts the results you are looking for.
Copy link to clipboard
Copied
That doesn't populate the correct amounts.
The flow will be if it's 36 month term and the sku items = 25% of the customer sell price then take the sell price * .02778 + monthly service amount (with $200 added in the example) creates a the monthly payment of $477.80 for a $10,000 sell price. If it has less than 25% sku items it would a monthly payment of $523.50.
Below is the formula that works for a file that only contains a 36 month option. My goal is to add the 48 and 60 month options as well.
var A = this.getField("CustomerSalesPrice").value; // the value of field A;
var B = this.getField("MonthlyServiceAmount").value; // the value of field B;
var C = this.getField("Qualification").value; // the value of field C;
event.value = "";
if(C=="Yes"){event.value=A*.02778+B;}
else if(C=="No"){event.value=A*.03235+B};
Copy link to clipboard
Copied
Hi,
Just wondering if you were able to get this form up and running yet.
It took me a little longer than expected to figure it out but in the end I got it working. Here are the fields modified:
1) In the Dropdown fields selected Properties---> Options ---> "Commit selected value immediately" needed to be ticked
2) This is the custom calculation script for the "MonthlyPayment" text field:
var A = this.getField("CustomerSalesPrice").value;
var B = this.getField("MonthlyServiceAmount").value;
var C = this.getField("QualifyingPercentage").value;
var D = this.getField("SelectTerm").value;
event.value = "";
if (C<.7500 && D=="36") event.value = (A*.03235)+B;
else if(C>.7499 && D=="36") event.value = (A*.02778)+B;
else if(C<.7500 && D=="48") event.value = (A*.02377)+B;
else if(C>.7499 && D=="48") event.value = (A*.02291)+B;
else if(C<.7500 && D=="60") event.value = (A*.01925)+B;
else if(C>.7499 && D=="60") event.value = (A*.01897)+B;
3) To calculate the Yes or No answer in the "CiscoSKU" dropdown field automatically using the resulting percentage value from the "QualifyingPercentage" text field:
var A = this.getField("QualifyingPercentage").value;
event.value = "";
if (A<= .250000) event.value = "No";
else if(A>= .249999) event.value = "Yes";
4) To calculate the "Qualification" Yes or No answer automatically using the Qualifying Percentage, CiscoSKU and SlectTerm fields:
var A = this.getField("QualifyingPercentage").value;
var B = this.getField("CiscoSKU").value;
var D = this.getField("SelectTerm").value;
event.value = "";
if (A<= .750000) event.value = "No";
else if(A>= .749999) event.value = "Yes";
else if(B=="No") event.value = "No";
else if(D=="48") event.value = "No";
else if(D=="60") event.value = "No"
else if(D=="60") event.value = "No"
Hope this helps. Good luck!
Copy link to clipboard
Copied
Copy link to clipboard
Copied