Facility Control

 View Only
  • 1.  stateless STRUCT_ARRAY

    Posted 21 days ago

    Hi

    in DashBoard stateless="true" doesn't seem to work with type="STRUCT_ARRAY" parameters.

    Is this known? Or how should I get it to work?

    Thanks.



    ------------------------------
    Simon Liddicott
    Systems Engineer
    ------------------------------


  • 2.  RE: stateless STRUCT_ARRAY

    Posted 18 days ago

    The stateless attribute applies at the parameter level, and since a struct is effectively an array of parameters, it isn't inherited by child parameters. Unfortunately, this means the attribute is not automatically passed down.

    To get the desired behavior in Dashboard, you must explicitly set stateless="true" on each sub-parameter.

    Here's an example

    <abs contexttype="opengear" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" constrainttype="STRUCT" name="struct_apples" oid="struct_apples" templateoid="struct.template" type="STRUCT_ARRAY" widget="table">
                <value>
                   <subparam access="1" constrainttype="STRING_CHOICE" maxlength="0" name="apples_persistant" suboid="apples_persistant" type="STRING" value="Golden Delicious" widget="combo">
                      <constraint>Golden Delicious</constraint>
                      <constraint>Bramburn</constraint>
                      <constraint>Crab</constraint>
                      <constraint>Pink Lady</constraint>
                   </subparam>
                   <subparam access="1" constrainttype="STRING_CHOICE" maxlength="0" name="apples_stateless" stateless="true" suboid="apples_stateless" type="STRING" value="Golden Delicious" widget="combo">
                      <constraint>Golden Delicious</constraint>
                      <constraint>Bramburn</constraint>
                      <constraint>Crab</constraint>
                      <constraint>Pink Lady</constraint>
                   </subparam>
                </value>
             </param>
          </params>
       </meta>
       <table bottom="0" left="0" right="0" top="0">
          <tr>
             <simplegrid cols="3" colspan="1" fill="both" rows="3" rowspan="1" weightx="1.0" weighty="1.0">
                <param element="0" expand="true" oid="struct_apples" showlabel="false"/>
                <param expand="true" oid="struct_apples.0.apples_persistant" showlabel="false"/>
                <param expand="true" oid="struct_apples.0.apples_stateless" showlabel="false"/>
                <button buttontype="push" name="Refresh">
                   <task tasktype="ogscript">ogscript.reload('_top');</task>
                </button>
             </simplegrid>
             <dropspot colspan="1" fill="both" rowspan="1" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <dropspot colspan="1" fill="both" rowspan="1" weightx="1.0" weighty="1.0"/>
             <dropspot colspan="1" fill="both" rowspan="1" weightx="1.0" weighty="1.0"/>
          </tr>
       </table>
    </abs>
    


    ------------------------------
    Richard Crutwell
    Ross Video UK
    ------------------------------



  • 3.  RE: stateless STRUCT_ARRAY

    Posted 18 days ago
      |   view attached

    Thanks for this.

    I've tried that code in 9.16 and the stateless feature isn't consistent, I've been able to make the state change in the apples_stateless in the attached video.

    My workflow is using external xml for panel data.

    My default entry is:

              <param access="1" constrainttype="STRUCT" name="Channels"
                   oid="quantel.channels.template" stateless="true"
                   type="STRUCT" widget="default">
                   <value>
                        <subparam access="0" constrainttype="INT_NULL"
                             name="Port" precision="0" stateless="true"
                             suboid="port" type="INT16" value="0" widget="default"/>
                        <subparam access="0" maxlength="-1" name="Name"
                             stateless="true" suboid="name" type="STRING"
                             value="?" widget="default"/>
                        <subparam access="0" maxlength="-1" name="Mode"
                             stateless="true" suboid="mode" type="STRING"
                             value="?" widget="default"/>
                   </value>
              </param>
              <param access="1" constrainttype="STRUCT" name="Channels"
                   oid="quantel.channels" stateless="true"
                   templateoid="quantel.channels.template"
                   type="STRUCT_ARRAY" widget="default">
                   <value>
                        <subparam stateless="true" suboid="port" value="0"/>
                        <subparam stateless="true" suboid="name" value="?"/>
                        <subparam stateless="true" suboid="mode" value="?"/>
                   </value>
              </param>

    I parse an external JSON file to populate the STRUCT_ARRAY, so ideally the array is empty on load.
    What I get is all of the subparams get a saved state including the top entry with the explicit stateless:

              <param access="1" constrainttype="STRUCT" name="Channels"
                   oid="quantel.channels" stateless="true"
                   templateoid="quantel.channels.template"
                   type="STRUCT_ARRAY" widget="default">
                   <value>
                        <subparam stateless="true" suboid="port" value="0"/>
                        <subparam stateless="true" suboid="name" value=""/>
                        <subparam stateless="true" suboid="mode" value="Idle"/>
                   </value>
                   <value>
                        <subparam suboid="port" value="1"/>
                        <subparam suboid="name" value=""/>
                        <subparam suboid="mode" value="Idle"/>
                   </value>
                   <value>
                        <subparam suboid="port" value="2"/>
                        <subparam suboid="name" value="QvdcpI 0"/>
                        <subparam suboid="mode" value="Cued"/>
                   </value>
                   <value>
                        <subparam suboid="port" value="3"/>
                        <subparam suboid="name" value="QvdcpI 1"/>
                        <subparam suboid="mode" value="Cued"/>
                   </value>
                   <value>
                        <subparam suboid="port" value="4"/>
                        <subparam suboid="name" value=""/>
                        <subparam suboid="mode" value="Idle"/>
                   </value>
                   <value>
                        <subparam suboid="port" value="5"/>
                        <subparam suboid="name" value="QvdcpI 2"/>
                        <subparam suboid="mode" value="Cued"/>
                   </value>
              </param>


    ------------------------------
    Simon Liddicott
    Systems Engineer
    ------------------------------



  • 4.  RE: stateless STRUCT_ARRAY

    Posted 18 days ago

    Thanks for the video - I'll pass this on to the product team, as the behavior appears to be inconsistent.

    If you need an entry to return to its default values and you're already using JSON to build structs in your project, I'd suggest creating a method to explicitly reset the entry. This avoids relying on the stateless attribute to revert values, though it does mean handling the behavior in script instead.

    Here is an example for an alternative method.

    <abs contexttype="opengear" id="_top" keepalive="false">
       <meta>
          <api immediate="true">function defaultEntry0(obj){
    params.setValue('quantel.channels', 0, obj);
    ogscript.debug('defaulted top entry');
    }</api>
          <ogscript handles="onload" targetid="_top">var obj =  {
        "port": 0,
        "name": "?",
        "mode": "?"
      };
    
    defaultEntry0(obj)</ogscript>
          <params>
             <param access="1" constrainttype="STRUCT" name="Channels" oid="quantel.channels.template" stateless="true" type="STRUCT" widget="default">
                <value>
                   <subparam access="0" constrainttype="INT_NULL" name="Port" precision="0" stateless="true" suboid="port" type="INT16" value="0" widget="default"/>
                   <subparam access="0" maxlength="-1" name="Name" stateless="true" suboid="name" type="STRING" value="?" widget="default"/>
                   <subparam access="0" maxlength="-1" name="Mode" stateless="true" suboid="mode" type="STRING" value="?" widget="default"/>
                </value>
             </param>
             <param access="1" constrainttype="STRUCT" name="Channels" oid="quantel.channels" stateless="true" templateoid="quantel.channels.template" type="STRUCT_ARRAY" widget="default">
                <value>
                   <subparam stateless="true" suboid="port" value="0"/>
                   <subparam stateless="true" suboid="name" value="?"/>
                   <subparam stateless="true" suboid="mode" value="?"/>
                </value>
             </param>
             <param access="1" constrainttype="STRUCT" name="Channels" oid="quantel.channels" stateless="true" templateoid="quantel.channels.template" type="STRUCT_ARRAY" widget="default">
                <value>
                   <subparam stateless="true" suboid="port" value="0"/>
                   <subparam stateless="true" suboid="name" value=""/>
                   <subparam stateless="true" suboid="mode" value="Idle"/>
                </value>
                <value>
                   <subparam suboid="port" value="1"/>
                   <subparam suboid="name" value=""/>
                   <subparam suboid="mode" value="Idle"/>
                </value>
                <value>
                   <subparam suboid="port" value="2"/>
                   <subparam suboid="name" value="QvdcpI 0"/>
                   <subparam suboid="mode" value="Cued"/>
                </value>
                <value>
                   <subparam suboid="port" value="3"/>
                   <subparam suboid="name" value="QvdcpI 1"/>
                   <subparam suboid="mode" value="Cued"/>
                </value>
                <value>
                   <subparam suboid="port" value="4"/>
                   <subparam suboid="name" value=""/>
                   <subparam suboid="mode" value="Idle"/>
                </value>
                <value>
                   <subparam suboid="port" value="5"/>
                   <subparam suboid="name" value="QvdcpI 2"/>
                   <subparam suboid="mode" value="Cued"/>
                </value>
             </param>
          </params>
       </meta>
       <table bottom="0" left="0" right="0" top="0">
          <tr>
             <simplegrid cols="3" colspan="1" fill="both" rows="3" rowspan="1" weightx="1.0" weighty="1.0">
                <param element="0" expand="true" oid="struct_apples" showlabel="false"/>
                <param expand="true" oid="struct_apples.0.apples_persistant" showlabel="false"/>
                <param expand="true" oid="struct_apples.0.apples_stateless" showlabel="false"/>
                <button buttontype="push" name="Refresh">
                   <task tasktype="ogscript">ogscript.reload('_top');</task>
                </button>
                <param editable="false" expand="true" oid="apples_stateless" showlabel="false"/>
                <param expand="true" oid="apples_persistant" showlabel="false"/>
                <button buttontype="push" name="Change top entry">
                   <task tasktype="ogscript">var obj = {
        "port": 99,
        "name": "Device 99",
        "mode": "active"
      };
    defaultEntry0(obj)</task>
                </button>
                <param expand="true" oid="port2" showlabel="false"/>
             </simplegrid>
             <dropspot colspan="1" fill="both" rowspan="1" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <param colspan="1" expand="true" fill="both" oid="quantel.channels" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             <param colspan="1" expand="true" fill="both" oid="quantel.channels.template" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
       </table>
    </abs>
    


    ------------------------------
    Richard Crutwell
    Ross Video UK
    ------------------------------



  • 5.  RE: stateless STRUCT_ARRAY

    Posted 17 days ago

    Hi Simon,

    I would just like to add that if your parameters are living in an external XML I believe it is expected behaviour unfortunately for stateless to no longer to work as expected. From my understanding stateless is a feature that was intended for internal params. And I do believe Richard is correct on the point that stateless behaviour on a struct is not going to make the subparams inherit the stateless attribute.



    ------------------------------
    Antony Giraldo
    DashBoard Custom Panel Developer
    Ross Video Creative Services | Rocket Surgery Triggering and Control
    ------------------------------