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

SOLVED

simple calculation in ES8

robertletts
Level 1
Level 1

i am trying to put a simple calculation with an if exception

if(Field2>Field3) then field1=(Field3-Field2)

I cannot get this basic thing to work and I am by no means a programmer.

Thansk for any help!

1 Accepted Solution
Steve_L_Walker
Correct answer by
Level 10
Level 10

If they are numeric fields the following FormCalc applies to field1.

// form1.page1.field1::calculate - (FormCalc, client)


if (field2 > field3) then

  field3 - field2

endif

Steve

View solution in original post

0 Replies
westlakejager
Level 3
Level 3

Place this script (as FormCalc) in the script editor under calculate:

if (Field2 > Field3) then Sum (Field3 - Field2)

else null

endif

null can also be 0, or whatever calculation you want.

Steve_L_Walker
Correct answer by
Level 10
Level 10

If they are numeric fields the following FormCalc applies to field1.

// form1.page1.field1::calculate - (FormCalc, client)


if (field2 > field3) then

  field3 - field2

endif

Steve

View solution in original post

robertletts
Level 1
Level 1

Thank you! I finally got htis to work. I don't know if the issue was the fact I was trying to put this all on one lline. Very helpful though.