Facility Control

 View Only
  • 1.  Dropdown Data in Dashboard to Xpression

    Posted 10-21-2016 17:05

    Hi I am Working on a Election project in Xpression and need to create a Dashoboard to enter data!! I have a Xpression Scene with 6 Boxes for 6 candidates!! Each Box have a Visual logic setup that if a Change the party name it would change the color of the Box!! But I have 15 candidates What I need is to create a Dashboard to be able to pick from a Dropdown Box the name but when I select the name in the dropbox I need to votes,percent,party name,image path to be updated all at the same time and link the data to Xpression, So If I pick a candidate name, just selecting that name it would get the Votes Data So the Box in Xpression change accordingly! I already have the tha table built in DashBoard the part that I am lost at is what I need to do get the Data From the table and with a Dropdown populate the data in Xpression!! Here's a image of the table that I created and the Dropdowns (the dropdowns are dummy objects for now and for position only at this time) Do I need to put labels with the corresponding data in each Candiate Field? Any help will be very Appreciated!!

    afc



  • 2.  RE: Dropdown Data in Dashboard to Xpression

    Posted 10-21-2016 21:35
    You need to create parameters for the values you actually want to send to XPression

    candidate1.name
    candidate1.votes
    candidate1.anything_else_to_send

    candidate2.name
    candidate2.votes
    candidate2.anything_else_to_send

    candidate3.name
    candidate3.votes
    candidate3.anything_else_to_send


    Then you can add a task to set the values of those parameters based on which candidate is selected.

    params.setValue('candidate1.votes', params.getValue('oid_for_the_votes_parameter', params.getValue('oid_for_the_selection_parameter', 0));

    Does this help?

    James


    #DashBoard


  • 3.  RE: Dropdown Data in Dashboard to Xpression

    Posted 10-24-2016 15:18

    Hi James and thanks for the Help!! I already have the parameters and their data!! There are in the table and I can Edit the data directly in the table!!
    What I need to do is be able with a Dropdown of the names populate the corresponding Labels so Xpression can update it!!




    You need to create parameters for the values you actually want to send to XPression

    candidate1.name
    candidate1.votes
    candidate1.anything_else_to_send

    candidate2.name
    candidate2.votes
    candidate2.anything_else_to_send

    candidate3.name
    candidate3.votes
    candidate3.anything_else_to_send


    Then you can add a task to set the values of those parameters based on which candidate is selected.

    params.setValue('candidate1.votes', params.getValue('oid_for_the_votes_parameter', params.getValue('oid_for_the_selection_parameter', 0));

    Does this help?

    James

     


    #DashBoard


  • 4.  RE: Dropdown Data in Dashboard to Xpression

    Posted 10-24-2016 16:02

    So the problem you are having is you don't know how to update the labels under the dropdown list when the dropdown list's selection changes, correct?

    Here is a demo panel that should show you how to do such a thing:

    <abs contexttype="opengear" style="">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Names" oid="params.names" precision="0" stateless="true" type="STRING_ARRAY" value="Name 1;Name 2;Name 3" widget="default">
                <value>Name 1</value>
                <value>Name 2</value>
                <value>Name 3</value>
             </param>
             <param access="1" maxlength="0" name="Parties" oid="params.parties" precision="0" stateless="true" type="STRING_ARRAY" value="Party 1;Party 2;Party 3" widget="default">
                <value>Party 1</value>
                <value>Party 2</value>
                <value>Party 3</value>
             </param>
             <param access="1" constrainttype="INT_NULL" name="Votes" oid="params.votes" precision="0" stateless="true" type="INT16_ARRAY" value="1;2;3" widget="default"/>
             <param access="1" constrainttype="STRING_CHOICE" name="Table" oid="params.table" precision="0" stateless="true" type="INT16" value="-1" widget="table">
                <constraint>params.names</constraint>
                <constraint>params.parties</constraint>
                <constraint>params.votes</constraint>
             </param>
             <param access="1" maxlength="0" name="XPression Names" oid="xpression.names" precision="0" type="STRING_ARRAY" value="Name 3;Name 3;" widget="label">
                <value>Name 3</value>
                <value>Name 3</value>
                <value>
                </value>
             </param>
             <param access="1" maxlength="0" name="XPression Parties" oid="xpression.parties" precision="0" type="STRING_ARRAY" value="Party 3;Party 3;" widget="label">
                <value>Party 3</value>
                <value>Party 3</value>
                <value>
                </value>
             </param>
             <param access="1" constrainttype="INT_NULL" name="XPression Votes" oid="xpression.votes" precision="0" type="INT16_ARRAY" value="3;3;0" widget="label"/>
             <param access="1" constrainttype="INT_CHOICE" name="XPression Selectors" oid="xpression.selectors" precision="0" type="INT16_ARRAY" value="2;2;-1" widget="default">
                <constraint key="-1">SELECT ONE</constraint>
                <constraint key="0">Name 1</constraint>
                <constraint key="1">Name 2</constraint>
                <constraint key="2">Name 3</constraint>
             </param>
          </params>
          <api>function copyParameters(index)
    {
       var selectedIndex = params.getValue('xpression.selectors', index);
       var nameToUse = '';
       var partyToUse = '';
       var votesToUse = 0;
    
       if (selectedIndex &gt;= 0)
       {
          nameToUse = params.getValue('params.names', selectedIndex);
          partyToUse = params.getValue('params.parties', selectedIndex);
          votesToUse = params.getValue('params.votes', selectedIndex);
       }
    
       params.setValue('xpression.names', index, nameToUse);
       params.setValue('xpression.parties', index, partyToUse);
       params.setValue('xpression.votes', index, votesToUse);
    }
    </api>
       </meta>
       <param expand="true" height="483" left="5" oid="params.table" showlabel="false" top="7" width="993"/>
       <table height="249" left="6" style="bg#dark;bdr:etched;" top="498" width="327">
          <tr>
             <param colspan="2" element="0" expand="true" fill="both" insets="2,2,2,2" left="13" oid="xpression.selectors" rowspan="1" runtasksonload="true" showlabel="false" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">/*! block id=1000 !*/
    copyParameters(0)
    /*!!
     &lt;block id="1000" type="function_copyParameters" x="10" y="100" w="243" index="0" /&gt;
    !!*/
    /*!!&lt;checksum&gt;709cb77fa54965293d59b588d7407ca6&lt;/checksum&gt;!!*/</task>
             </param>
          </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.names" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Party: " 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.parties" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Votes: " 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.votes" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <button colspan="2" fill="both" insets="2,2,2,2" name="Refresh" rowspan="1" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">/*! block id=1000 !*/
    copyParameters(0)
    /*!!
     &lt;block id="1000" type="function_copyParameters" x="10" y="100" w="243" index="0" /&gt;
    !!*/
    /*!!&lt;checksum&gt;709cb77fa54965293d59b588d7407ca6&lt;/checksum&gt;!!*/</task>
             </button>
          </tr>
       </table>
       <table height="249" left="340" style="bg#dark;bdr:etched;" top="500" width="327">
          <tr>
             <param colspan="2" element="1" expand="true" fill="both" insets="2,2,2,2" left="13" oid="xpression.selectors" rowspan="1" runtasksonload="true" showlabel="false" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">/*! block id=1001 !*/
    copyParameters(1)
    /*!!
     &lt;block id="1001" type="function_copyParameters" x="10" y="100" w="243" index="1" /&gt;
    !!*/
    /*!!&lt;checksum&gt;c8adfab8b853c3fd0492e5fd9cb0aa82&lt;/checksum&gt;!!*/</task>
             </param>
          </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="1" expand="true" fill="both" insets="2,2,2,2" oid="xpression.names" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Party: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
             <param colspan="1" element="1" expand="true" fill="both" insets="2,2,2,2" oid="xpression.parties" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Votes: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
             <param colspan="1" element="1" expand="true" fill="both" insets="2,2,2,2" oid="xpression.votes" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <button buttontype="push" colspan="2" fill="both" insets="2,2,2,2" name="Refresh" rowspan="1" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">
    
    
    /*! block id=1000 !*/
    copyParameters(1)
    /*!!
     &lt;block id="1000" type="function_copyParameters" x="10" y="100" w="243" index="1" /&gt;
    !!*/
    /*!!&lt;checksum&gt;4a92c89c8fdfbbe9b283240a348724c1&lt;/checksum&gt;!!*/</task>
             </button>
          </tr>
       </table>
       <table height="249" left="677" style="bg#dark;bdr:etched;" top="502" width="327">
          <tr>
             <param colspan="2" element="2" expand="true" fill="both" insets="2,2,2,2" left="13" oid="xpression.selectors" rowspan="1" runtasksonload="true" showlabel="false" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">/*! block id=1002 !*/
    copyParameters(2)
    /*!!
     &lt;block id="1002" type="function_copyParameters" x="10" y="100" w="243" index="2" /&gt;
    !!*/
    /*!!&lt;checksum&gt;0e3c1fd2bc0663d8b9be5eef10afb494&lt;/checksum&gt;!!*/</task>
             </param>
          </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="2" expand="true" fill="both" insets="2,2,2,2" oid="xpression.names" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Party: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
             <param colspan="1" element="2" expand="true" fill="both" insets="2,2,2,2" oid="xpression.parties" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="Votes: " rowspan="1" style="txt-align:east;" weightx="0.0" weighty="1.0"/>
             <param colspan="1" element="2" expand="true" fill="both" insets="2,2,2,2" oid="xpression.votes" rowspan="1" showlabel="false" weightx="1.0" weighty="1.0"/>
          </tr>
          <tr>
             <button buttontype="push" colspan="2" fill="both" insets="2,2,2,2" name="Refresh" rowspan="1" top="501" weightx="1.0" weighty="1.0">
                <task tasktype="ogscript">
    
    
    /*! block id=1000 !*/
    copyParameters(2)
    /*!!
     &lt;block id="1000" type="function_copyParameters" x="10" y="100" w="243" index="2" /&gt;
    !!*/
    /*!!&lt;checksum&gt;aa984189aad6f8147340a852b64952e7&lt;/checksum&gt;!!*/</task>
             </button>
          </tr>
       </table>
    </abs>

    The key part is this piece of code that copies the parameters from the table to the ones you are trying to DataLinq:

    function copyParameters(index)
    {
    var selectedIndex = params.getValue('xpression.selectors', index);
    var nameToUse = '';
    var partyToUse = '';
    var votesToUse = 0;

    if (selectedIndex >= 0)
    {
    nameToUse = params.getValue('params.names', selectedIndex);
    partyToUse = params.getValue('params.parties', selectedIndex);
    votesToUse = params.getValue('params.votes', selectedIndex);
    }

    params.setValue('xpression.names', index, nameToUse);
    params.setValue('xpression.parties', index, partyToUse);
    params.setValue('xpression.votes', index, votesToUse);
    }


    Hopefully I have correctly answered your question. If not, please feel free to let me know.

    "‹James


    #DashBoard


  • 5.  RE: Dropdown Data in Dashboard to Xpression

    Posted 10-24-2016 20:57

    Thanks a LOT James!!! That Works Perfect!!! and it was Exactly what I needed!! I modified the Source code an was able to use it with the names and data that I need it!!!

    One last Thing is what I need to copy or duplicate to get the other paramaters that I need in the Xpression output Labels? I already created the new parameters as you can see in the image!! I just need to added to the in the list of the Dropdown name menu?

    Also How can I copy the Dropdown Tables Because I need 6 candidates and the example is only for 3.

    James Thanks for the GREAT SUPPORT!!!!!

    afc


    So the problem you are having is you don't know how to update the labels under the dropdown list when the dropdown list's selection changes, correct?

    Here is a demo panel that should show you how to do such a thing:

    Hopefully I have correctly answered your question. If not, please feel free to let me know.

    "‹James

     


    #DashBoard


  • 6.  RE: Dropdown Data in Dashboard to Xpression

    Posted 10-27-2016 22:16

    Hi James!! I was able to add the other fields in the tables and it is changing corresponding to the correct data!! But the problem that I have is when I tried to copy the table to have 6 the copied tables still referencing the old data!!! When I change the name in the dropdown menu all the new copied tables change as well!!!! I tried to edit the visual logic Copy parameters box to a new one and added 3 more lines in the selector parameter and still I get same results in the copied tables!!! How Can I copy the tables and have each one change independently?

    Thanks
    afc


    #DashBoard