Skip to main content
Oct 11, 2018 6:23 PM UTC
Answered

Convert formcalc to javascript

Trying to convert following formcalc script to javascript, and not getting to work.  Just wondering if someone could take a look at and possibly convert to javascript?  Thank you so much!    IF(Personnel_nab>=0,Personnel_nab+-Personnel_osb)

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer
Oct 11, 2018 6:51 PM UTC

OK, thank you!  Very helpful!

4 replies

Legend
Oct 11, 2018 6:50 PM UTC

Ok, the key thing you are missing is connecting it to the fields. In JavaScript a name is just a place to keep stuff, not the name of a field unless you do something like this:

var Personnel_nab = this.getField("Personnel_nab") ;

and so on for each field. Then your lines should be OK. Pay very close attention to exact details like the quotes used, punctuation, and capital letters like the F in getField.

Also get in the habit of opening the JavaScript console. If anything goes wrong, your messages will show up only in the console.

Translate
Correct answer
Oct 11, 2018 6:51 PM UTC

OK, thank you!  Very helpful!

Translate
Legend
Oct 11, 2018 6:28 PM UTC

Please show us your attempt, so we can help you understand what is wrong rather than just solving the one problem.

Translate
Oct 11, 2018 6:39 PM UTC

Sorry, it is incomplete. 

if (Personnel_nab >= 0) {

  Personnel_nab = Personnel_nab+-Personnel_osb;

}

Translate