Facility Control

 View Only
  • 1.  Table to populate data from dropdown menu

    Posted 06-06-2024 21:28

    I have a simple table in dashboard which I would like to populate team values from the table once a team is selected from a dropdown menu.
    What is the best way to do this?

    <abs contexttype="opengear" id="_top" keepalive="false" style="">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Table Short Names" oid="params.shortnames" precision="0" type="STRING_ARRAY" widget="default">
                <value>NEW</value>
                <value>SYD</value>
                <value>BRI</value>
             </param>
             <param access="1" constrainttype="STRING_CHOICE" name="Table" oid="params.table" precision="0" type="INT16" value="2" widget="table">
                <constraint>params.teamnames</constraint>
                <constraint>params.shortnames</constraint>
                <constraint>params.established</constraint>
                <constraint>params.colour</constraint>
                <constraint>params.logo</constraint>
             </param>
             <param access="1" maxlength="0" name="Table Team Names" oid="params.teamnames" precision="0" type="STRING_ARRAY" widget="default">
                <value>Newcastle</value>
                <value>Sydney</value>
                <value>Brisbane</value>
             </param>
             <param access="1" maxlength="0" name="Table Established" oid="params.established" precision="0" type="STRING_ARRAY" widget="default">
                <value>1999</value>
                <value>2000</value>
                <value>2001</value>
             </param>
             <param access="1" constrainttype="INT_CHOICE" name="Xpression Selector 1" oid="xpression.selector1" precision="0" type="INT16_ARRAY" value="-1" widget="default">
                <constraint key="-1">Select Team</constraint>
                <constraint key="0"/>
             </param>
             <param access="1" maxlength="0" name="Xpression Team Names" oid="xpression.teamnames" precision="0" type="STRING_ARRAY" widget="label">
                <value>0</value>
             </param>
             <param access="1" maxlength="0" name="Xpression Short Names" oid="xpression.shortnames" precision="0" type="STRING_ARRAY" widget="label">
                <value>0</value>
             </param>
             <param access="1" maxlength="0" name="Xpression Established" oid="xpression.established" precision="0" type="STRING_ARRAY" widget="label">
                <value>0</value>
             </param>
             <param access="1" maxlength="0" name="Table Colour" oid="params.colour" precision="0" type="STRING_ARRAY" widget="default">
                <value>#FF5733</value>
                <value>#FFFFFF</value>
                <value>#000000</value>
             </param>
             <param access="1" maxlength="0" name="Table Logo" oid="params.logo" precision="0" type="STRING_ARRAY" widget="default">
                <value>https://www.nrl.com/.theme/knights/badge.svg?bust=202405130630</value>
                <value>https://www.nrl.com/.theme/broncos/badge.svg?bust=202405130630</value>
                <value>https://www.nrl.com/.theme/roosters/badge.svg?bust=202405130630</value>
             </param>
             <param access="1" maxlength="0" name="Xpression Colour" oid="xpression.colour" precision="0" type="STRING_ARRAY" widget="label">
                <value>0</value>
             </param>
             <param access="1" maxlength="0" name="Xpression Logo" oid="xpression.logo" precision="0" type="STRING_ARRAY" widget="label">
                <value>0</value>
             </param>
          </params>
       </meta>
       <abs height="671" left="9" top="7" width="1135">
          <param expand="true" height="222" left="446" oid="params.table" showlabel="false" top="22" width="675"/>
       <table height="352" left="39" style="bg#dark;bdr:etched;" top="39" width="267">
             <tr>
                <param colspan="2" expand="true" fill="both" insets="2,2,2,2" left="13" oid="xpression.selector1" rowspan="1" runtasksonload="true" showlabel="false" top="501" weightx="1.0" weighty="1.0"/>
             </tr>
             <tr>
                <label colspan="1" fill="both" insets="2,2,2,2" name="Name: " rowspan="1" style="txt-align:east" weightx="0.0" weighty="1.0"/>
                <param colspan="1" element="0" expand="true" fill="both" insets="2,2,2,2" oid="xpression.teamnames" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             </tr>
             <tr>
                <label colspan="1" fill="both" insets="2,2,2,2" name="Short Name: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
                <param colspan="1" element="0" expand="true" fill="both" insets="2,2,2,2" oid="xpression.shortnames" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             </tr>
             <tr>
                <label colspan="1" fill="both" insets="2,2,2,2" name="Established: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
                <param colspan="1" element="0" expand="true" fill="both" insets="2,2,2,2" oid="xpression.established" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             </tr>
             <tr>
                <label colspan="1" fill="both" insets="2,2,2,2" name="Colour:" rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
                <param colspan="1" element="0" expand="true" fill="both" insets="2,2,2,2" oid="xpression.colour" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             </tr>
             <tr>
                <label colspan="1" fill="both" insets="2,2,2,2" name="Logo:" rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
                <param colspan="1" element="0" expand="true" fill="both" insets="2,2,2,2" oid="xpression.logo" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
             </tr>
          </table>
       </abs>
    </abs>


    ------------------------------
    Sam McIntosh
    National Rugby League
    Australia
    ------------------------------


  • 2.  RE: Table to populate data from dropdown menu

    Posted 06-07-2024 17:18

    I do something similar to set team info from a table. Here's an adapted version. Your dropdown didn't have any teams in it, so I added the three teams to the dropdown and then I put this task onto the dropdown:

    var SelectedTeam = params.getStrValue('xpression.selector1', 0);
    var length = params.getElementCount('params.teamnames');
    ogscript.debug("Found " + length + " teams in the table");
    length = length -1;
    
    for (var i=0;i<=length;i++)
    {
    var TeamName = params.getValue('params.teamnames', i);
    
    if (SelectedTeam === TeamName)
    {
    //Set Team Name
       params.setValue('xpression.teamnames', 0, TeamName);
       ogscript.debug("SETTING TEAM NAME: " + TeamName);
    //Set Short Name
       var ShortName = params.getValue('params.shortnames', i);
       params.setValue('xpression.shortnames', 0, ShortName);
       ogscript.debug("SETTING SHORT NAME: " + ShortName);
    //Set Established
       var Established = params.getValue('params.established', i);
       params.setValue('xpression.established', 0, Established);
       ogscript.debug("SETTING ESTABLISHED: " + Established);
    //Set Colour
       var Colour = params.getValue('params.colour', i);
       params.setValue('xpression.colour', 0, Colour);
       ogscript.debug("SETTING COLOUR: " + Colour);
    //Set Logo
       var Logo = params.getValue('params.logo', i);
       params.setValue('xpression.logo', 0, Logo);
       ogscript.debug("SETTING LOGO: " + Logo);
    
    }
    }

     



    ------------------------------
    Jake Lew
    Access Communications Co-Operative Limited
    Regina Canada
    ------------------------------



  • 3.  RE: Table to populate data from dropdown menu

    Posted 06-11-2024 19:59

    Great that works, thanks Jake!
    It would be nice if the team names could be added to the dropdown automatically.



    ------------------------------
    Sam McIntosh
    National Rugby League
    Australia
    ------------------------------



  • 4.  RE: Table to populate data from dropdown menu

    Posted 06-12-2024 11:00

    I also have that function in my project! Would go something like this:

    //Set Dropdown Selection
    var length = params.getElementCount('params.teamnames');
    length = length -1;
    
    var nameArray = new Array();
    for (i=0;i<=length;i++)
    {
       var name = params.getValue('params.teamnames', i);
       nameArray[nameArray.length] = name;
    }
    
    params.replaceConstraint('xpression.selector1', params.createIntChoiceConstraint(nameArray));



    ------------------------------
    Jake Lew
    Access Communications Co-Operative Limited
    Regina Canada
    ------------------------------



  • 5.  RE: Table to populate data from dropdown menu

    Posted 06-13-2024 19:17

    Thanks again Jake, this is great.
    Much appreciated



    ------------------------------
    Sam McIntosh
    National Rugby League
    Australia
    ------------------------------