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 ListSort By Multiple Fields?Sort By Multiple Fields?
Previous
 
Next
New Post
3/4/2010 12:58 PM
 

 I'm trying to write an xsl file that will sort by more than one field.  I can make it work with one field based on the included xsl files, but am unable to this point to get multiple fields to work.

Has anyone done this before?

 
New Post
3/4/2010 2:15 PM
 

 By the time my question went live, I was able to figure it out.  If anyone else needs to do it, the solution is relatively simple.  You simply add another sort node.  Here's an example:  This example sorts by the following fields: Member_Type, State, Institution_Name.  All text fields and all in ascending order.

<xsl:apply-templates select="$currentData" mode="list">
    <xsl:sort select="udt:Member_Type" order="ascending" data-type="text" />
    <xsl:sort select="udt:State" order="ascending" data-type="text" />
    <xsl:sort select="udt:Institution_Name" order="ascending" data-type="text" />
</xsl:apply-templates>

 
New Post
3/4/2010 2:33 PM
 

If you hardcode which fields to sort on in the XSL code, you can sort by multiple fields.  Simply duplicate the <xsl:sort> tags with the secondary sorting.

If you're not doing a custom XSL output, you can simply create a calculated field for sorting that combines the data from the other fields (this will really only work if the fields are all text fields).

 
New Post
3/4/2010 2:37 PM
 

Do you want to change the sorting dynamically?

If not, then you can add multiple <xsl:sort select=".." /> to your script.

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListSort By Multiple Fields?Sort By Multiple Fields?


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