The parameter template declares the options which should be available to the user when running the script. After the user has selected their parameter values, EMGworks transparently creates a Parameter member in the script namespace containing the user's selections. The example below shows how each type of parameter may be accessed inside the Calculate or Validate functions, assuming a namespace MYS.
// access a series parameter
var sampleCount = MYS.Parameter.ExampleInputA.NumPoints;
// access a numeric parameter
var a = MYS.Parameter.ExampleInputB;
// perform a test on a boolean parameter
if (MYS.Parameter.ExampleInputC)
{
// do something if the user checked the ExampleInputC checkbox
}
// perform a task based on an enumeration selection
// enumeration selections are declared as the index of the selection
if (MYS.Parameter.ExampleInputD == 0)
{
// the user selected "Option 1"
}
else if (MYS.Parameter.ExampleInputD == 1)
{
// the user selected "Option 2"
}