• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

For field calculation help

New Here ,
Sep 17, 2019 Sep 17, 2019

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}

 

Views

547

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 17, 2019 Sep 17, 2019

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 ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

We are trying to have a payment calculated based off the SelectTerm field and the rate factor that corresponded to the term and the 0% qualification. i.e. if they pick 48 month and the qualifying percent is less than 75% it uses one rate factor, if it's more than 75% it uses a different one.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

Hi,

 

See if the totals in my slide are correct:

 

 

payment.png

 

 

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)};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2019 Sep 18, 2019

Copy link to clipboard

Copied

this is for the individual monthly payment (payment per month)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2019 Sep 18, 2019

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)};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 18, 2019 Sep 18, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2019 Sep 27, 2019

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};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 06, 2019 Oct 06, 2019

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 07, 2019 Oct 07, 2019

Copy link to clipboard

Copied

I appreciate the help. This is super close. The CiscoSKU field isn't based on a calculation within the form - it is something the user would enter manually. Is there a way to adjust for that?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 07, 2019 Oct 07, 2019

Copy link to clipboard

Copied

LATEST
Can you specify how do you need it adjusted or how do want it to work? (Is just easier for me to understand your last question like that)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines