Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListDisplay latest Changed at value onlyDisplay latest Changed at value only
Previous
 
Next
New Post
11/18/2014 12:51 PM
 

I have a table with eight rows.  Ski conditions for each trail in a park.  Outside of the table, I want to display the greatest value of Changed at_UDT_Value so that the user can see when any record was last updated, not a last updated for each record.  See the code below, which doesn't quite work but I think I'm on to something:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:udt="DotNetNuke/UserDefinedTable" exclude-result-prefixes="udt">
<xsl:output method="xml" indent="yes" omit-xml-declaration="yes" />
<!--
This prefix is used to generate module specific query strings
Each querystring or form value that starts with udt_{ModuleId}_param
will be added as parameter starting with param
-->
<xsl:variable name="prefix_param">udt_<xsl:value-of select="//udt:Context/udt:ModuleId" />_param</xsl:variable>

<xsl:template match="udt:Data" mode="list">
<tr class="dnnGridItem row">
<td style="width:25%">
<xsl:call-template name="EditLink" />
<xsl:value-of select="udt:TrailName" disable-output-escaping="yes" />
</td>
<td style="width:8.33%;text-align:center;">
<xsl:value-of select="udt:Difficulty" disable-output-escaping="yes" />&#160;
</td>
<td style="width:8.33%;text-align:center;">
<xsl:value-of select="udt:Km" disable-output-escaping="yes" />
</td>
<td style="width:8.33%;text-align:center;">
<xsl:value-of select="udt:Miles" disable-output-escaping="yes" />
</td>
<td style="width:50%">
<xsl:value-of select="udt:Conditions" disable-output-escaping="yes" />&#160;
</td>
</tr>
</xsl:template>

<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name="currentData" select="udt:Data" />
<xsl:if test="$currentData">
<table class="dnnFormItem">
<tr class="dnnGridItem row">
<td style="width:25%">
<b>Trail Name</b>
</td>
<td style="width:8.33%;text-align:center;">
<b>Difficulty</b>
</td>
<td style="width:8.33%;text-align:center;">
<b>Km</b>
</td>
<td style="width:8.33%;text-align:center;">
<b>Mi</b>
</td>
<td style="width:50%">
<b>Conditions</b>
</td>
</tr>
<xsl:apply-templates select="$currentData" mode="list">
</xsl:apply-templates>
</table>
<xsl:variable name="lastUpdated">
<xsl:for-each select="udt:Changed_x0020_at_UDT_Value">
<xsl:sort select="." order="ascending" />
<xsl:if test="position() = last()">
<xsl:value-of select="." />
</xsl:if>
</xsl:for-each>
</xsl:variable>
<em>Last Updated: <xsl:value-of select="$lastUpdated" disable-output-escaping="yes" /></em>
</xsl:if>

</xsl:template>

<xsl:template name="EditLink">
<xsl:if test="udt:EditLink">
<a href="{udt:EditLink}">
<img border="0" alt="edit" src="{//udt:Context/udt:ApplicationPath}/images/edit.gif" />
</a>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

 
New Post
11/19/2014 11:41 AM
 
Bill,

Don't know if this page will help you or not.
http://www.formandlist.com/Documentat...
 
New Post
11/19/2014 12:20 PM
 

My end result should look like:

Trail 1 Condition
Trail 2 Condition
Trail 3 Condition

Last Updated xx/xx/xxxx xx:xx

Perhaps Trail 2 was the latest updated, but I don't want them sorted by last updated.  I guess my question is whether it's possible to loop through the dataset twice essentially, once with the natural sorting order displaying the results, second sorting by last updated and displaying the last result.  In the code above the bold section is where I believe the pulling of update values, sorting and then displaying the last() one.  Should this be somewhere else?

 
New Post
11/19/2014 2:08 PM
 

Something like this:

  <xsl:template match="/udt:UserDefinedTable">

    <xsl:variable name="currentData" select="udt:Data" />
    <xsl:if test="$currentData">
      <table class="dnnFormItem">
        <xsl:apply-templates select="$currentData" mode="list">
        </xsl:apply-templates>
      </table>
    <em>Last Changed: <xsl:value-of select="$lastUpdated"/></em>
    </xsl:if>
  </xsl:template>
 
      <xsl:variable name ="lastUpdated">
      <xsl:for-each select="//udt:Data/udt:Changed_x0020_at">
        <xsl:sort select="udt:Changed_x0020_at" data-type="text" order="ascending"/>
        <xsl:if test="position() = 1">
          <xsl:value-of select="." />
        </xsl:if>
      </xsl:for-each>
    </xsl:variable>
 
New Post
11/19/2014 3:53 PM
 
Timo
That's really close! It displays the first record timestamp in the right place, however, no matter how I change it, it doesn't want to sort the records. Removing the position conditional displays all records. The order seems to be the same as the natural order of the table. Using Changed_x0020_at_UDT_Value changed the formatting correctly for displaying but still did nothing for the sort. It appears we'd need to sort by either the original value or ticks as there doesn't appear to be a natural datetime data type for sorting.
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListDisplay latest Changed at value onlyDisplay latest Changed at value only


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out