Facility Control

 View Only
  • 1.  DASHBOARD XML QUERY

    Posted 07-07-2023 09:19
    Hi Guyz,
    DISCLAIMER: I am a complete novice in programing language, BUT still attampting to learn ogscript in DASBOARD.
    After going thru various youtube videos and lots of threads in this group, i have been able to achieve few things on Dashboard.
     
    MY QUERY
    I have an xml file which contains ID, Teamname, TRICODE, Player 1 to 5 names.
    I am able to import Teamname data into Dashboard (i am able to import only 1 data from my xml file)
    What i want to do is, based on my selection of the teamname from my dropdown list i should get ALL the relevent players name also in my DASHBOARD.
    I will then connect all this to my xpression.
    The end result will be that i choose the team name on dashboard and my xpression graphic shows the team name and all the players in that team.
    My dashboard codes are 
     
    <abs contexttype="opengear" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" constrainttype="INT_CHOICE" name="TEAMNAME" oid="TEAMNAME" precision="0" type="INT32" value="1" widget="combo">
                <constraint key="1">CLOUD</constraint>
                <constraint key="2">INFERNAL</constraint>
                <constraint key="3">MOUNTAIN</constraint>
                <constraint key="4">OCEAN</constraint>
             </param>
          </params>
       </meta>
       <abs height="460" left="79" style="bg#buttonbg;bdr#red;bdr:round;" top="64" width="582">
          <param expand="true" height="54" left="40" oid="TEAMNAME" top="120" width="154"/>
          <button buttontype="push" height="50" left="36" name="GET DATA" top="46" width="152">
             <task tasktype="ogscript">var xmlDocument = ogscript.parseXML('TEST INFO XML.xml');         //Parse the XML
       var nodeList = xmlDocument.getElementsByTagName("Team"); //Get the tags we want to include in the constraint
       var constraintData = [];   //Placeholder for the new constraint data
     
    for (var i = 0; i &lt; nodeList.getLength(); i++)           //Loop through each tag we found
    {   
       var node = nodeList.item(i);                          //Get the node
       constraintData.push({"key": parseInt(node.getAttribute("ID")), "value": node.getAttribute("TeamName")});  //Push the key/value pair
    }
     
    if (constraintData.length == 0)  //Placeholder if we don't have anything (OPTIONAL)
    {
       constraintData.push({"key": 0, "value": "Nothing"});
    }
     
    var constraint = params.createIntChoiceConstraint(constraintData);   //Create the constraint
    params.replaceConstraint("TEAMNAME", constraint);</task>
          </button>
       </abs>
    </abs>
     
    My xml file is 
    <TeamFile>
    <Team ID="1" TeamName="CLOUD" TRICODE="CLD" PLAYER1="RINGOKUN" PLAYER2="TIMA" PLAYER3="JERICHO" PLAYER4="CHICO" PLAYER5="CRAFT"/>
    <Team ID="2" TeamName="INFERNAL" TRICODE="INF" PLAYER1="SENMARIE" PLAYER2="TATSU" PLAYER3="GINROU" PLAYER4="MEYER" PLAYER5="PHONICS"/>
    <Team ID="3" TeamName="MOUNTAIN" TRICODE="MTN" PLAYER1="USSIE" PLAYER2="HALDES" PLAYER3="YUJI" PLAYER4="NEXUS GREEN" PLAYER5="LILLET"/>
    <Team ID="4" TeamName="OCEAN" TRICODE="OCN" PLAYER1="AIM4" PLAYER2="LACON" PLAYER3="AKAINU" PLAYER4="HOSHIZUKI" PLAYER5="FWRK"/>
    </TeamFile>


    ------------------------------
    Gaurav
    ------------------------------


  • 2.  RE: DASHBOARD XML QUERY

    Posted 07-08-2023 06:28

    Question, will there allways be 5 players on a team? 



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



  • 3.  RE: DASHBOARD XML QUERY

    Posted 07-08-2023 08:52
    Hi Aleksander, 
    The no. of players will not be dynamic, so yes there will always be 5 players.
    Gaurav