getIdentifiedConstraint

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 :slight_smile:

`

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

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