Facility Control

 View Only
  • 1.  getIdentifiedConstraint

    Posted 06-12-2015 07:44

    Hi

    I am trying to use getIdentifiedConstraint and getConstraint to get information about the constraints of a parameter. The ogScript-documentation is very scarce on information about these functions.

    To take my problem for instance:

    I have a integer-parameter with several constraints. It looks like this:

    Value: 1 Name: abc
    Value: 2 Name: xyz

    I know the value I need to find within these constraints. What I am looking for is the "Name" of that value. I would think like this, but of course it doesn't work:

    var value = this.getValue(); // Don't worry about how I know this
    var allMyChoices = params.getConstraint (0x15);
    var MySingeChoice = allMyChoices.getIdentifiedConstraint (value);
    var myName = MySingleChoice.getValueAsString();

    I know it may be hard to understand what I am trying to accomplish here, but a brief overview of how the constraint-scripting works would be appreciated :)



  • 2.  RE: getIdentifiedConstraint

    Posted 06-12-2015 19:50
    `

    var value = this.getValue(); // Don't worry about how I know this

    var myStringValue = this.getValueAsString(); //Okay, but did you know you could just do this?

    //If you're still curious, here's the answer to your question

    var allMyChoices = params.getConstraint(0x15);

    var myChoiceName = allMyChoices.getStringOf(value);

    `

    #DashBoard


  • 3.  RE: getIdentifiedConstraint

    Posted 06-12-2015 19:55

    You can also get the full list of choices with:

    `

    var choices = allMyChoices.getChoices();

    for (var i = 0; i < choices.length; i++)

    {

    ogscript.debug(choices[i].getValue() + ' = ' + choices[i].getName());

    }

    `

    #DashBoard