Facility Control

 View Only
  • 1.  Changing parameter constraints

    Posted 02-21-2015 14:53

    Hi!

    I have a string-parameter with X constraints. The constraints are to by updated by an external API-call. The following code does not work:

    var myArray = ["Coice A", "Choice B", "Choice C"]; // Dummydata
    
    var constraints = params.createIntChoiceConstraint(myArray);
    
    params.replaceConstraint (0x8, constraints); // 0x8 is the OID of my parameter

    What am I doing wrong+



  • 2.  RE: Changing parameter constraints

    Posted 02-23-2015 15:03
    Hi Kenneth.

    createIntChoiceConstraint only works with INT16, INT16_ARRAY, INT32, and INT32_ARRAY parameters. They won't work with STRING and STRING_ARRAY.

    If you are choosing from a fixed list, then you should be able to get what you want by changing parameter 0x8 to an integer parameter. You can still get the string value out of the parameter with params.getStrValue(0x8, 0); in ogScript (the string value is also passed to XPression).

    If you need the list to be editable, there are ways in DashBoard 6.x to change between different StringChoiceConstraints but no way to create new ones at runtime (there is in DashBoard 7 - available as a beta. Just not in 6.x)

    #DashBoard