Skip to main content
October 11, 2018
Answered

Convert formcalc to javascript

  • October 11, 2018
  • 2 replies
  • 853 views

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 has been closed for replies.
Correct answer

OK, thank you!  Very helpful!

2 replies

Legend
October 11, 2018

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.

Correct answer
October 11, 2018

OK, thank you!  Very helpful!

Legend
October 11, 2018

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

October 11, 2018

Sorry, it is incomplete. 

if (Personnel_nab >= 0) {

  Personnel_nab = Personnel_nab+-Personnel_osb;

}