Facility Control

 View Only
  • 1.  DashBoard BUG? Parameter for Struct Table changes without asking it to?

    Posted 10-07-2024 09:58

    Hi there. I'm currently working with my students in making a dashboard for them for hockey.
    And for some reason DashBoard bugs out.

    Looking at the dashboard below, you can see I have a table, with 4 subparams, and they work just fine as it is. Look specifically at line 21.

    <abs contexttype="opengear" dblinqport="2235" gridsize="10" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" maxlength="0" name="matchtime" oid="matchtime" type="STRING" value="20:00" widget="text"/>
             <param access="1" maxlength="0" name="HomePen1" oid="HomePen1" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="HomePen2" oid="HomePen2" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayPen1" oid="AwayPen1" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayPen2" oid="AwayPen2" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="HomeGoal" oid="HomeGoal" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayGoal" oid="AwayGoal" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="state" oid="state" type="STRING" value="localtime" widget="text-display"/>
             <param access="1" constrainttype="STRUCT" name="Team Def" oid="teamDef" stream="false" structtype="teamDef" type="STRUCT_ARRAY" widget="table">
                <value>
                   <subparam access="1" maxlength="-1" name="Team" suboid="team" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="Team Short" suboid="teamShort" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="Logo" suboid="logo" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="ID" suboid="id" type="STRING" value="---" widget="default"/>
                </value>
                <config key="p.additive">true</config>
             </param>
             <param access="1" constrainttype="STRUCT" name="Team Info" oid="teamInfo" stream="false" structtype="teamDef" templateoid="teamDef" type="STRUCT_ARRAY" widget="table">
                <value>
                   <subparam suboid="team" value="Lillehammer"/>
                   <subparam suboid="teamShort" value="L.I.K."/>
                   <subparam suboid="logo" value="Lillehammer.png"/>
                   <subparam suboid="id" value="123"/>
                </value>
                <value>
                   <subparam suboid="team" value="Storhamar"/>
                   <subparam suboid="teamShort" value="SIL"/>
                   <subparam suboid="logo" value="Storhamar.png"/>
                   <subparam suboid="id" value="456"/>
                </value>
                <value>
                   <subparam suboid="team" value="Vårlerenga"/>
                   <subparam suboid="teamShort" value="VIF"/>
                   <subparam suboid="logo" value="Vårleregna.png"/>
                   <subparam suboid="id" value="789"/>
                </value>
             </param>
          </params>
       </meta>
       <abs height="140" left="90" name="listner-canvas" top="200" width="300">
          <meta>
             <listener autostart="true" id="listener1" listenport="22987" maxlength="1024" name="listener1" udp="true">
                <task tasktype="ogscript">if (event.getEventType() == 1) {
       var msg = event.getBytesAsString();
       ogscript.debug(msg);
       msg = msg.toLowerCase();
       msg = JSON.parse(msg);
       //ogscript.debug(msg)

       var type = Object.keys(msg)[0];
       //ogscript.debug(type);

       //CLOCK UPDATE FUNCTIONS
       if(type == "time") {
          //Set timestate
          params.setValue('state', 0, msg.time.timestate);

          var state = params.getValue('state', 0);
          var period = msg.time.period;
          var matchtime = msg.time.matchtime;
          ogscript.debug('Match time: ' + matchtime);

          //TIMERS
          var homePen1 = msg.teamstatistics.hometeam.pen1time;
          var homePen2 = msg.teamstatistics.hometeam.pen2time;
          var awayPen1 = msg.teamstatistics.awayteam.pen1time;
          var awayPen2 = msg.teamstatistics.awayteam.pen2time;

          if (state == ("match" || "matchchecked")) {
             params.setValue('matchtime', 0, matchtime);
          }
          if (state == "prewarmupchecked") {
             params.setValue('matchtime', 0, "20:00");
             
          }
          
          params.setValue('HomePen1', 0, homePen1);
          params.setValue('HomePen2', 0, homePen2);
          params.setValue('AwayPen1', 0, awayPen1);
          params.setValue('AwayPen2', 0, awayPen2);

          //GOALS
          var homeGoal = msg.teamstatistics.hometeam.goals;
          var awayGoal = msg.teamstatistics.awayteam.goals;

          params.setValue('HomeGoal', 0, homeGoal);
          params.setValue('AwayGoal', 0, awayGoal);

                

       }


       //TIMERTICK FUNCTIONS
       if(type == "timertick") {
          var state = params.getValue('state', 0);
          var matchtime = msg.timertick;
          var homePen1 = msg.pen1hometime;
          var homePen2 = msg.pen2hometime;
          var awayPen1 = msg.pen1awaytime;
          var awayPen2 = msg.pen2awaytime;
         
          if (state == ("match" || "matchchecked")) {
             params.setValue('matchtime', 0, matchtime);
          }
          //Home Pen 1 set time
          if (homePen1 != null) {
             params.setValue('HomePen1', 0, homePen1);   
          } else {
             params.setValue('HomePen1', 0, '');   
          }
          //Home Pen 2 set time
          params.setValue('HomePen2', 0, homePen2);
           if (homePen2 != null) {
             params.setValue('HomePen2', 0, homePen2);   
          } else {
             params.setValue('HomePen2', 0, '');
          } 


          //Away Pen 1 set time
          params.setValue('AwayPen1', 0, awayPen1);
          if (awayPen1 != null) {
             params.setValue('AwayPen1', 0, awayPen1);   
          } else {
             params.setValue('AwayPen1', 0, '');
          } 
          //Away Pen 2 set time
          params.setValue('AwayPen2', 0, awayPen2);
          if (awayPen2 != null) {
             params.setValue('AwayPen2', 0, awayPen2);   
          } else {
             params.setValue('AwayPen2', 0, ''); 
          }
       }
    }</task>
             </listener>
          </meta>
       </abs>
       <param expand="true" height="40" left="800" oid="matchtime" top="110" width="120"/>
       <param expand="true" height="30" left="730" oid="HomePen1" top="180" width="90"/>
       <param expand="true" height="30" left="730" oid="HomePen2" top="220" width="90"/>
       <param expand="true" height="30" left="900" oid="AwayPen1" top="180" width="100"/>
       <param expand="true" height="30" left="900" oid="AwayPen2" top="220" width="100"/>
       <param expand="true" height="60" left="730" oid="HomeGoal" top="270" width="90"/>
       <param expand="true" height="60" left="900" oid="AwayGoal" top="270" width="100"/>
       <param expand="true" height="50" left="1210" oid="state" top="140" width="170"/>
       <button buttontype="push" height="240" left="90" name="array" top="380" width="370">
          <task tasktype="ogscript">var myarray = ["henry", "Aleks", "Ingrid", "thomas", "solveig", "robin"];

    //ogscript.debug(myarray);
    //ogscript.debug(myarray[0]);
    var x = myarray.length;
    //ogscript.debug(x);

    for (var i = 0; i &lt; x; i++) {
       ogscript.debug(myarray[i]);
    }</task>
       </button>
       <button buttontype="push" height="230" left="90" name="object" top="650" width="370">
          <task tasktype="ogscript">var lag1 = {team:"Lillehammer", teamshort:"L.I.K.", logo:"Lillehammer.png"}
    var test = JSON.stringify(lag1);
    ogscript.debug(test);

    ogscript.debug(lag1.teamshort);</task>
       </button>
       <abs left="970" top="660"/>
       <param editable="false" evenstyle="f:bg#1E1E1E;" expand="true" height="240" left="540" oddstyle="f:bg#8B008C;" oid="teamInfo" showlabel="false" top="390" width="480"/>
    <button buttontype="push" height="60" left="540" name="ADD" top="640" width="130">
          <task tasktype="ogscript">var x = params.getElementCount('teamInfo');

    var newTeam = {
       "id": "",
       "team": "",
       "teamShort": "",
       "logo": ""
    };

    params.setValue('teamInfo', x, newTeam);</task>
       </button>

    </abs>

    ---------------------------------------------------------------------------------------------------------------------------------------------

    But if I click the "ADD" button, that just simply adds a new row of empty string values. Followed up by going into the ADD button in edit mode, click apply and close. No editing, no coding, no style changes, nothing. Just open the button and click "apply and close".
    Then for some reason DashBoard goes in and changes the code and removes the attributes for the STRUCT ARRAY parameter and that holds the information pr row. Look at the below code, and especially line 21.

    ---------------------------------------------------------------------------------------------------------------------------------------------

    <abs contexttype="opengear" dblinqport="2235" gridsize="10" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" maxlength="0" name="matchtime" oid="matchtime" type="STRING" value="20:00" widget="text"/>
             <param access="1" maxlength="0" name="HomePen1" oid="HomePen1" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="HomePen2" oid="HomePen2" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayPen1" oid="AwayPen1" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayPen2" oid="AwayPen2" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="HomeGoal" oid="HomeGoal" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="AwayGoal" oid="AwayGoal" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="state" oid="state" type="STRING" value="localtime" widget="text-display"/>
             <param access="1" constrainttype="STRUCT" name="Team Def" oid="teamDef" stream="false" structtype="teamDef" type="STRUCT_ARRAY" widget="table">
                <value>
                   <subparam access="1" maxlength="-1" name="Team" suboid="team" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="Team Short" suboid="teamShort" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="Logo" suboid="logo" type="STRING" value="---" widget="default"/>
                   <subparam access="1" maxlength="-1" name="ID" suboid="id" type="STRING" value="---" widget="default"/>
                </value>
                <config key="p.additive">true</config>
             </param>
             <param base="teamDef" name="Team Info" oid="teamInfo" stream="false">
                <value>
                   <subparam suboid="team" value="Lillehammer"/>
                   <subparam suboid="teamShort" value="L.I.K."/>
                   <subparam suboid="logo" value="Lillehammer.png"/>
                   <subparam suboid="id" value="123"/>
                </value>
                <value>
                   <subparam suboid="team" value="Storhamar"/>
                   <subparam suboid="teamShort" value="SIL"/>
                   <subparam suboid="logo" value="Storhamar.png"/>
                   <subparam suboid="id" value="456"/>
                </value>
                <value>
                   <subparam suboid="team" value="Vårlerenga"/>
                   <subparam suboid="teamShort" value="VIF"/>
                   <subparam suboid="logo" value="Vårleregna.png"/>
                   <subparam suboid="id" value="789"/>
                </value>
                <value>
                   <subparam suboid="id" value=""/>
                   <subparam suboid="team" value=""/>
                   <subparam suboid="teamShort" value=""/>
                   <subparam suboid="logo" value=""/>
                </value>
             </param>
          </params>
       </meta>
       <abs height="140" left="90" name="listner-canvas" top="200" width="300">
          <meta>
             <listener autostart="true" id="listener1" listenport="22987" maxlength="1024" name="listener1" udp="true">
                <task tasktype="ogscript">if (event.getEventType() == 1) {
       var msg = event.getBytesAsString();
       ogscript.debug(msg);
       msg = msg.toLowerCase();
       msg = JSON.parse(msg);
       //ogscript.debug(msg)

       var type = Object.keys(msg)[0];
       //ogscript.debug(type);

       //CLOCK UPDATE FUNCTIONS
       if(type == "time") {
          //Set timestate
          params.setValue('state', 0, msg.time.timestate);

          var state = params.getValue('state', 0);
          var period = msg.time.period;
          var matchtime = msg.time.matchtime;
          ogscript.debug('Match time: ' + matchtime);

          //TIMERS
          var homePen1 = msg.teamstatistics.hometeam.pen1time;
          var homePen2 = msg.teamstatistics.hometeam.pen2time;
          var awayPen1 = msg.teamstatistics.awayteam.pen1time;
          var awayPen2 = msg.teamstatistics.awayteam.pen2time;

          if (state == ("match" || "matchchecked")) {
             params.setValue('matchtime', 0, matchtime);
          }
          if (state == "prewarmupchecked") {
             params.setValue('matchtime', 0, "20:00");
             
          }
          
          params.setValue('HomePen1', 0, homePen1);
          params.setValue('HomePen2', 0, homePen2);
          params.setValue('AwayPen1', 0, awayPen1);
          params.setValue('AwayPen2', 0, awayPen2);

          //GOALS
          var homeGoal = msg.teamstatistics.hometeam.goals;
          var awayGoal = msg.teamstatistics.awayteam.goals;

          params.setValue('HomeGoal', 0, homeGoal);
          params.setValue('AwayGoal', 0, awayGoal);

                

       }


       //TIMERTICK FUNCTIONS
       if(type == "timertick") {
          var state = params.getValue('state', 0);
          var matchtime = msg.timertick;
          var homePen1 = msg.pen1hometime;
          var homePen2 = msg.pen2hometime;
          var awayPen1 = msg.pen1awaytime;
          var awayPen2 = msg.pen2awaytime;
         
          if (state == ("match" || "matchchecked")) {
             params.setValue('matchtime', 0, matchtime);
          }
          //Home Pen 1 set time
          if (homePen1 != null) {
             params.setValue('HomePen1', 0, homePen1);   
          } else {
             params.setValue('HomePen1', 0, '');   
          }
          //Home Pen 2 set time
          params.setValue('HomePen2', 0, homePen2);
           if (homePen2 != null) {
             params.setValue('HomePen2', 0, homePen2);   
          } else {
             params.setValue('HomePen2', 0, '');
          } 


          //Away Pen 1 set time
          params.setValue('AwayPen1', 0, awayPen1);
          if (awayPen1 != null) {
             params.setValue('AwayPen1', 0, awayPen1);   
          } else {
             params.setValue('AwayPen1', 0, '');
          } 
          //Away Pen 2 set time
          params.setValue('AwayPen2', 0, awayPen2);
          if (awayPen2 != null) {
             params.setValue('AwayPen2', 0, awayPen2);   
          } else {
             params.setValue('AwayPen2', 0, ''); 
          }
       }
    }</task>
             </listener>
          </meta>
       </abs>
       <param expand="true" height="40" left="800" oid="matchtime" top="110" width="120"/>
       <param expand="true" height="30" left="730" oid="HomePen1" top="180" width="90"/>
       <param expand="true" height="30" left="730" oid="HomePen2" top="220" width="90"/>
       <param expand="true" height="30" left="900" oid="AwayPen1" top="180" width="100"/>
       <param expand="true" height="30" left="900" oid="AwayPen2" top="220" width="100"/>
       <param expand="true" height="60" left="730" oid="HomeGoal" top="270" width="90"/>
       <param expand="true" height="60" left="900" oid="AwayGoal" top="270" width="100"/>
       <param expand="true" height="50" left="1210" oid="state" top="140" width="170"/>
       <button buttontype="push" height="240" left="90" name="array" top="380" width="370">
          <task tasktype="ogscript">var myarray = ["henry", "Aleks", "Ingrid", "thomas", "solveig", "robin"];

    //ogscript.debug(myarray);
    //ogscript.debug(myarray[0]);
    var x = myarray.length;
    //ogscript.debug(x);

    for (var i = 0; i &lt; x; i++) {
       ogscript.debug(myarray[i]);
    }</task>
       </button>
       <button buttontype="push" height="230" left="90" name="object" top="650" width="370">
          <task tasktype="ogscript">var lag1 = {team:"Lillehammer", teamshort:"L.I.K.", logo:"Lillehammer.png"}
    var test = JSON.stringify(lag1);
    ogscript.debug(test);

    ogscript.debug(lag1.teamshort);</task>
       </button>
       <abs left="970" top="660"/>
       <param editable="false" evenstyle="f:bg#1E1E1E;" expand="true" height="240" left="540" oddstyle="f:bg#8B008C;" oid="teamInfo" showlabel="false" top="390" width="480"/>
    <button buttontype="push" height="60" left="540" name="ADD" top="640" width="130">
          <task tasktype="ogscript">var x = params.getElementCount('teamInfo');

    var newTeam = {
       "id": "",
       "team": "",
       "teamShort": "",
       "logo": ""
    };

    params.setValue('teamInfo', x, newTeam);</task>
       </button>

    </abs>

    This is tested in DashBoard version 9.10.3 and 9.10.2, will also test in earlier version when I get home.
    This is a solution I have used on many dashboards before and for some reason acts up now.
    If anyone can find an error somewhere that I or my student has overlooked, that'd be great, but at the moment I am stumped.



    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 2.  RE: DashBoard BUG? Parameter for Struct Table changes without asking it to?

    Posted 10-08-2024 08:42

    Hi Aleksander, 

    Two things I noticed from your panel:

    1. The STRUCT template type attribute was set to STRUCT_ARRAY. Change this to type="STRUCT"
    2. When adding objects to the STRUCT Table make sure to keep to the same schema as the subparams in the STRUCT_ARRAY already. This may cause the param to crash that has the effect of disappearing or re-editing itself in Dashboard, that is Dashboard attempts to recover I believe. It might not be the reason here, however.



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



  • 3.  RE: DashBoard BUG? Parameter for Struct Table changes without asking it to?

    Posted 10-17-2024 05:43

    Thank you! It was as simple as the STRUCT_ARRAY addition, and it worked.
    As for the schema of the additional entries, the order of the subparams should not matter with suboid, and also with the additive set to true, you can even ommit one of them, and add it later (is my experience anyhow).



    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------