Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Percentage help

Avatar

Not applicable
I have a form where I need to add the dollar amounts for projected small business spend and large business spend. (which is entered by the user) Then, actual cumulative smal and large spend is also entered by the user.



I need to know how to write the script for calculating the percentage of cumulative spend in relation to projected spend.



cumulative spend = % of projected spend

Projected spend = 200.00

50.00 is what % of 200.00



Here is the code I tried:



if(TotalCurrent ne 0) then

(SmallActual / TotalCurrent) * 100

else

null

endif



Here is the error:



Script failed (language is formcalc; context is

xfa[0].form[0].topmostSubform[0].Page1[0].SmallActual[0])

script=endif

Error: syntax error near token 'endif' on line1, column 5.



Any help is appreciated. I am new to this program.
2 Replies

Avatar

Level 3

Can you send me the form so I can review it and help?

Thanks.

Avatar

Level 6

This is javascript:

if (TotalCurrent.rawValue != 0) {

(SmallActual.rawValue / TotalCurrent.rawValue)*100;

} else {

// Set field to blank (or whatever else you would want) here

}