Skip to main content
Participant
November 16, 2016
Answered

I created a form to integrate in another system. I'd like to have a "rate table" in it so that depending in the $ merged in one field, the % fee is variable

  • November 16, 2016
  • 1 reply
  • 379 views

I'd like to have a "rate table" in it so that depending in the $ merged in one field, the % fee is variable. Is that possible? Probably with a bunch of "if than" but I don't know how to program this.

Thanks

This topic has been closed for replies.
Correct answer try67

You can use something like this as the custom calculation script of the fee field (adjust field names and values as necessary, of course):

var amount = Number(this.getField("Amount").value);

if (amount==0) event.value = 0;

else if (amount<=200) event.value = 0.1;

else if (amount<=400) event.value = 0.25; // etc.

else event.value = 0.5;

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 16, 2016

You can use something like this as the custom calculation script of the fee field (adjust field names and values as necessary, of course):

var amount = Number(this.getField("Amount").value);

if (amount==0) event.value = 0;

else if (amount<=200) event.value = 0.1;

else if (amount<=400) event.value = 0.25; // etc.

else event.value = 0.5;

Participant
November 16, 2016

It's working, you're a genius. Thank you very much.

For the beginners like me who are reading this, amout with the lower a is my variable rate and the field is called "varrate" and the Amount with the higher A is the value of the premium and that field is called "totalpremium". So just change the names according to your current field and it should work fine.

Thanks again