Facility Control

 View Only
Expand all | Collapse all

Override carbonite MLE Background source bus param array, but keep dynamic labels

  • 1.  Override carbonite MLE Background source bus param array, but keep dynamic labels

    Posted 09-26-2016 18:32

    I overrode 0xE06 so I could have only the sources I needed. (I don't need "NoSrc" or Aux busses showing up). However, by doing that, I no longer inherit the source label assigned to that source.

    <param baseurl="http://10.0.97.209/tmp/busestab.xml" constrainttype="INT_CHOICE" expand="true" oid="0xE06" precision="0" showlabel="false" style="size:Small;t:bg#FF0D0D;f:bg#readonlybg;" widget="radio-toggle">
             <constraint key="0">BK</constraint>
             <constraint key="1000">1</constraint>
             <constraint key="1001">2</constraint>
             <constraint key="1002">3</constraint>
             <constraint key="1003">4</constraint>
             <constraint key="1004">5</constraint>
             <constraint key="1005">6</constraint>
             <constraint key="1006">7</constraint>
             <constraint key="1007">8</constraint>
             <constraint key="1008">9</constraint>
             <constraint key="1009">10</constraint>
             <constraint key="1010">11</constraint>
             <constraint key="1011">12</constraint>
             <constraint key="1012">13</constraint>
             <constraint key="1013">14</constraint>
             <constraint key="1014">15</constraint>
             <constraint key="1015">16</constraint>
             <constraint key="10">BG</constraint>
             <constraint key="100">M1</constraint>
             <constraint key="101">M2</constraint>
             <constraint key="102">M3</constraint>
             <constraint key="103">M4</constraint>
             <constraint key="25000">MinME1</constraint>
             <constraint key="25100">MinME2</constraint>
             <constraint key="25200">MinME3</constraint>
             <constraint key="25300">MinME4</constraint>
          </param>

    So, instead of this:

    <constraint key="1000">1</constraint>

    I would like to dynamically have this (which is what I would get if I didn't override):

    <constraint key="1000">Cam 1</constraint>

     



  • 2.  RE: Override carbonite MLE Background source bus param array, but keep dynamic labels

    Posted 09-26-2016 18:52

    Hi Mark.
    One way to work around this issue is to use ogScript to update your constraint override with a new copy that uses the current labels applied to the Carbontie.

    If you add the attribute id="bus-view" to your parameter, this little piece of ogScript would do the trick:

    var paramConstraint = params.getParam('0xE06', 0).getConstraint();
    var viewConstraint = params.getViewConstraint('bus-view');

    var newConstraint = [];
    var viewChoices = viewConstraint.getChoices();
    for (var i = 0; i < viewChoices.length; i++)
    {
    var updatedLabel = paramConstraint.getStringOf(viewChoices[i].getValue());
    newConstraint.push({"key": viewChoices[i].getValue(), "value":updatedLabel});
    }

    var updatedConstraint = params.createIntChoiceConstraint(newConstraint);

    params.replaceViewConstraint('bus-view', updatedConstraint);



    Here is a more complete example where I have only chosen to show 5 sources from my Carbonite and want a button that can refresh the names.

    <abs contexttype="opengear" objectid="Carbonite 00:0F:9B:02:15:D9&lt;br&gt;Slot 0&lt;br&gt;Carbonite" objecttype="Carbonite">
       <meta>
          <api immediate="true">function refreshLabels()
    {
       var paramConstraint = params.getParam('0xE06', 0).getConstraint();
       var viewConstraint = params.getViewConstraint('bus-view');
       
       var newConstraint = [];
       var viewChoices = viewConstraint.getChoices();
       for (var i = 0; i &lt; viewChoices.length; i++)
       {
          var updatedLabel = paramConstraint.getStringOf(viewChoices[i].getValue());
          newConstraint.push({"key": viewChoices[i].getValue(), "value":updatedLabel});
       }
       
       var updatedConstraint = params.createIntChoiceConstraint(newConstraint);
       
       params.replaceViewConstraint('bus-view', updatedConstraint);
    }
    </api>
          <ogscript handles="onload">refreshLabels();</ogscript>
       </meta>
       <param constrainttype="INT_CHOICE" expand="true" height="254" id="bus-view" left="96" oid="0xE06" precision="0" showlabel="false" top="61" width="732">
          <constraint key="1000">a</constraint>
          <constraint key="1001">b</constraint>
          <constraint key="1002">c</constraint>
          <constraint key="1003">d</constraint>
          <constraint key="1004">e</constraint>
       </param>
       <button buttontype="push" height="96" left="98" name="Update" top="331" width="723">
          <task tasktype="ogscript">refreshLabels();</task>
       </button>
    </abs>

    #DashBoard