HomeHomeDotNetNuke Forg...DotNetNuke Forg...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
HomeHomeDotNetNuke Forg...DotNetNuke Forg...Module ForumsModule ForumsForm and ListForm and ListGrouping, Total and SortingGrouping, Total and Sorting


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Start  Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

Sponsors

DotNetNuke Corporation

DotNetNuke (DNN) provides a suite of solutions that make designing, building and managing feature-rich sites and communities fast, easy and cost-effective. The DotNetNuke Platform CMS is the foundation for more than one million websites worldwide. DNN Social, our newest solution, enables businesses to create immersive, interactive communities. Thousands of organizations like True Value Hardware, Bose, Cornell University, Glacier Water, Dannon, Delphi, USAA, NASCAR, Northern Health and the City of Denver have leveraged DNN to deploy highly engaging business- critical websites. Our rapid growth in product sales and deployments resulted in DotNetNuke Corp. being named one of the fastest growing private companies in America by Inc. Magazine in 2011 and 2012.