Expand my Community achievements bar.

Scripting & Applying Set Percentage in Javascript

Avatar

Level 1

I need to script a set percentage to an existing calculated total field in order to show a new field total with the set percentage applied. Total is already calculated in the form, but I'm not sure how to plug in the 2.25% to calculate for a final total.

Example:

Total ____

Final Total ____ (new field with 2.25 percentage applied)

3 Replies

Avatar

Level 10

To use a percentage in a total use these algorithm

Total * 1.0225 = Final Total

for 2.25%

to add a certain percentage

1.0225 = (2.25 / 100) +1

to remove a percentage

1 - (2.25 / 100) = 0.9775

to know a percentage of

2.25 / 100

Avatar

Level 1

Robert,

Great – thanks! I did figure that out (eventually), but now have the issue of the Permit Fee field showing $0.26 when it should just show $0.00 until the Number field is filled in and the amount is calculated. Can you help? The error screen says that it doesn’t like the last equal sign. I’m at a loss…

TopmostSubform.Page1.Cell[10].Permit_Fee::calculate - (FormCalc, client)

Permit_Fee.rawValue = (4000.00Cell[8].Number + 0.25)1.0225

If(Number.isNull | Permit_Fee = “”)

Thanks!

Noemi Harvell

Avatar

Level 10

Because you are using FormCalc it has different operators for statements...

You can look over the FormCalc User Reference Documentation to understand the language

Your If statement would look something like this

if (Number.isNull | Permit_Fee eq "")