Avatar

Correct answer by
Level 10

Hi,

in script objects you only can use JavaScript syntax, FormCalc in not supported by these objects at all.

As you also cannot call an JavaScript action from a FormCalc event.

You'll have to use JavaScript in all scenarios you're using the script objects.

Here's a sample how to do this.

Create a function in your script object, that contains some nested arrays.

Each array contains two values, the first represents the name the second the value.

Through the forEach method you can simply filter the arrays.


function loadValue (vValue){


  var aVars = [


  ["varA", "Lorem"],


  ["varB", "Ipsum"],


  ["varC", "Dolor"]


  ],


  vReturn;



  aVars.forEach(function (element, index) {


  if (element[0] == vValue) {


  vReturn = element[1];


  }


  });


  return vReturn;


}


Retrieve the value from array "varA" use this function.


Owners.loadValue ("varA");


View solution in original post