Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

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 ListGrouping, Total and SortingGrouping, Total and Sorting
Previous
 
Next
New Post
3/25/2012 7:13 PM
 

I followed this thread: http://www.dotnetnuke.com/Resources/F...   and learned a lot about grouping and totaling, (and more about FNL) but now, what would seem to be the simplest part is evading me.

My data table is a group of scouts going camping.
I'm grouping on campsite and summing the number of adults and youth in each campsite and also the combined total.   I summed the total in each campsite.
My field data are all calculated columns and I can't get the output to sort on any field.

I did this

<?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" />
<xsl:key name="data-by-campsite" match="udt:Data" use="udt:Campsite" />
<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="Normal">
<td>
<xsl:value-of select="udt:Campsite" disable-output-escaping="yes" />
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="ycampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$ycampsite]/udt:Youth)" disable-output-escaping="yes" />
</div>
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="acampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$acampsite]/udt:Adults)" disable-output-escaping="yes" />
</div>
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="tcampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$tcampsite]/udt:Total)" disable-output-escaping="yes" />
</div>
</td>
</tr>
</xsl:template>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name="currentData" select="udt:Data[count(. | key('data-by-campsite', udt:Campsite)[1]) = 1]" />
<xsl:if test="$currentData">
<table>
<tr>
<th>Campsite</th>
<th>Youth</th>
<th>Adults</th>
<th>Total</th>
</tr>
<xsl:apply-templates select="$currentData" mode="list">
<xsl:sort select="tyouth" data-type="number" order="ascending" />
</xsl:apply-templates>
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

All learning opportunities are appreciated.

Kevin

 
New Post
3/27/2012 4:16 PM
 

Hello..
I threw your XSL into an editor and you're trying to sort by "tyouth".  I didn't see a column anywhere by this name.

Is this a column which you've hidden and decided not to show within the XSL?

Thanks.. -Jeff


 
New Post
4/5/2012 10:11 AM
 
Jeff - Thanks for the reply. Actually, I've played with this so many times, I can't keep all my data straight.

tyouth was supposed to = Total Youth, which was used in another XSL. I have also tried this one with just "Total", which appears as "tcampsite". (total per campsite)

The overall module does not have a sorting column defined, so that is not overriding the XSL.

The output is here: http://neuseriverdistrict.org/springcamporee/Logistics/CampsiteAssignments.aspx

Still not sorted the way I'm trying.
 
New Post
4/5/2012 10:25 AM
 
<?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" />
<xsl:key name="data-by-campsite" match="udt:Data" use="udt:Campsite" />
<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="Normal">
<td>
<xsl:value-of select="udt:Campsite" disable-output-escaping="yes" />
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="ycampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$ycampsite]/udt:Youth)" disable-output-escaping="yes" />
</div>
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="acampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$acampsite]/udt:Adults)" disable-output-escaping="yes" />
</div>
</td>
<td>
<div class="row" style="text-align:right">
<xsl:variable name="tcampsite" select="udt:Campsite" />
<xsl:value-of select="sum(//udt:Data[udt:Campsite=$tcampsite]/udt:Total)" disable-output-escaping="yes" />
</div>
</td>
</tr>
</xsl:template>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name="currentData" select="udt:Data[count(. | key('data-by-campsite', udt:Campsite)[1]) = 1]" />
<xsl:if test="$currentData">
<table>
<tr>
<th>Campsite</th>
<th>Youth</th>
<th>Adults</th>
<th>Total</th>
</tr>
<xsl:apply-templates select="$currentData" mode="list">
<xsl:sort select="tcampsite" data-type="number" order="ascending" />
</xsl:apply-templates>
</table>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListGrouping, Total and SortingGrouping, Total and Sorting


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.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out