Announcement

Collapse
No announcement yet.

How to sort and make icons change based on conditions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How to sort and make icons change based on conditions

    I want to start off by saying "Job WELL Done!". Your programming is teaching me alot. I do have a few questions though.

    1) In the XLS file for your devices how do I get them to sort. This is part my Script: (ultra_view2_status_living_room.xsl)

    -----------------------------------------------------------------
    <table border="0" width="100%" cellpadding="0" cellspacing="1">
    <tr>
    <td class="tablecolumn" valign="top" align="left">Device</td>
    <td class="tablecolumn" valign="top" align="left">Status</td>
    </tr>
    <xsl:for-each select="DEVICE" >
    <xsl:sort select="DEVICE" order="ascending" />
    <xsl:sort select="TYPE" order="ascending" />
    <xsl:if test="LOCATION = 'Living Room'" >
    <tr>
    <td class="tableroweven" width="70%" valign="top" align="left">
    <xsl:value-of select="NAME" />
    </td>
    <td class="tablerowodd" width="30%" valign="top" align="left">
    <xsl:apply-templates select="ICON" /> <xsl:apply-templates select="STRING" />
    </td>
    </tr>
    </xsl:if>
    </xsl:for-each>
    </table>
    --------------------------------------------------------------------
    it produces:

    Back Door
    Front Door
    Overhead Lights
    Living Room Window
    Light Relay
    Curio Cabinet
    End table lamps

    I want to sort then in order from A-Z.

    2) Using the above example, how do I make it select an ICON based off of what the Status is?

    Thanks in advance for any help

    #2
    Any help?

    Comment


      #3
      This this posting:
      http://ubb.homeseer.com/eve/ubb.x?a=...53&m=967107685

      Thats the script I use to adjust the icons based on device status.
      Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

      Comment


        #4
        Sean,
        Sorry, looks like I missed question 1... did you figure it out? Looking at the code, try removing the following section:
        <pre class="ip-ubbcode-code-pre">
        &lt;xsl:sort select="TYPE" order="ascending" /&gt;
        </pre>
        Regards,
        Ultrajones
        Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

        Comment


          #5
          Thanks for the help. I tried doing what you suggested but get these results. Strange? Lost!

          &lt;table border="0" width="100%" cellpadding="0" cellspacing="0"&gt;
          &lt;tr&gt;
          &lt;td class="tablecolumn" valign="center" align="left"&gt;Device&lt;/td&gt;
          &lt;td class="tablecolumn" valign="center" align="left"&gt;Status&lt;/td&gt;
          &lt;/tr&gt;
          &lt;xsl:for-each select="DEVICE" &gt;
          &lt;xsl:sort select="DEVICE" order="ascending" /&gt;
          &lt;xsl:if test="LOCATION = 'Living Room'" &gt;
          &lt;tr&gt;
          &lt;td class="tableroweven" width="70%" valign="center" align="left"&gt;
          &lt;xsl:value-of select="NAME" /&gt;
          &lt;/td&gt;
          &lt;td class="tablerowodd" width="30%" valign="center" align="left"&gt;
          &lt;xsl:apply-templates select="ICON" /&gt; &lt;xsl:apply-templates select="STRING" /&gt;
          &lt;/td&gt;
          &lt;/tr&gt;
          &lt;/xsl:if&gt;
          &lt;/xsl:for-each&gt;
          &lt;/table&gt;


          Produces:

          Overhead Lights
          Back Door
          Front Door
          Light Relay
          Living Room Window
          Curio Cabinet
          End table lamps

          Still tring to figure this out but with no success.

          Comment


            #6
            Try sorting on the "NAME" instead of "DEVICE":
            <pre class="ip-ubbcode-code-pre">
            &lt;xsl:sort select="NAME" order="ascending" /&gt;
            </pre>
            Plug-ins: UltraMon, UltraM1G, UltraCID, Ultra1Wire, UltraLog, UltraWeatherBug, UltraPioneerAVR, UltraGCIR

            Comment


              #7
              That worked! That was too easy I almost feel embarrased! Thanks for the help!

              Comment

              Working...
              X