Facility Control

 View Only

Modify parameters based on the Choice parameter within the STRUCT

  • 1.  Modify parameters based on the Choice parameter within the STRUCT

    Posted 2 hours ago
    Everyone,
     
    To simplify data management, I created a Constraint SubParam within the STRUCT attribute's parameters.
     
    I also want to change the parameters that are overwritten based on its value.
     
    It seems to be working fine, but for some reason, pressing F5 to refresh sometimes reverts it back to the original value.
     
    I created a small test file to isolate the issue, but the same phenomenon occurs.
    Does anyone know the cause of this?
    Thanks
    <abs contexttype="opengear" id="_top" keepalive="false">
    <meta>
    <params>
    <param access="1" name="buttonData" oid="buttonData" type="STRUCT" widget="default">
    <value>
    <subparam access="1" constrainttype="INT_CHOICE" name="selected" precision="0" suboid="selected" type="INT16" value="0" widget="checkbox">
    <constraint key="0">zero</constraint>
    <constraint key="1">one</constraint>
    <constraint key="2">two</constraint>
    <constraint key="2">three</constraint>
    </subparam>
    <subparam access="1" name="button" suboid="button" type="STRUCT_ARRAY" widget="default">
    <value>
    <subparam access="1" maxlength="-1" name="name" suboid="name" type="STRING" value="1st" widget="default"/>
    </value>
    <value>
    <subparam suboid="name" value="2nd"/>
    </value>
    <value>
    <subparam suboid="name" value="3rd"/>
    </value>
    <value>
    <subparam suboid="name" value="4th"/>
    </value>
    </subparam>
    </value>
    </param>
    <param access="1" maxlength="0" name="rename" oid="rename" type="STRING" value="changed" widget="text"/>
    </params>
    </meta>
    <param expand="true" height="449" left="108" oid="buttonData.button" showlabel="false" top="96" width="390"/>
    <param expand="true" height="64" left="532" oid="rename" top="109" width="255"/>
    <param expand="true" height="62" left="550" oid="buttonData.selected" top="193" widget="0" width="233"/>
    <button buttontype="push" height="59" left="546" name="do rename" top="294" width="236">
    <task tasktype="ogscript">var target = params.getValue('buttonData.selected', 0);

    params.setValue('buttonData.button.'+ target +'.name', 0, params.getValue('rename', 0));</task>
    </button>
    </abs>


    ------------------------------
    Keisuke Nagata
    ------------------------------