sort tool by name?

lauren.fraser's Avatar


14 Jun, 2014 10:57 AM

I'm trying to sort by name and I'm not getting the results I intended. Here is my script:

#set ($folderPages = $_XPathTool.selectNodes($contentRoot, "/system-index-block/system-page[name != 'index']"))
#set ($folderName = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page/system-data-structure/folder-name"))
$_SortTool.addSortCriterion("name", "", "text", "ascending", "") 
#foreach ($folderPage in $folderPages)
    #set ($folderTitle = $folderPage.getChild("title"))
    #set ($folderPath = $folderPage.getChild("link").value)
    #set ($pageName = $folderPage.getChild("name"))
    <p><a href="${folderPath}">$_SerializerTool.serialize($folderTitle, true)</a></p>

And a sample of the xml from the index block:

<system-page id="5012122bac1009d0012b97c0bd8cd7f9">
<title>Kurt Bravata, MD</title>
<display-name>Kurt Bravata, MD</display-name>

This is basically a provider listing, the Display Name and title show the full name, and we want an alpha sort by last name. Since the page names are in the format lastname-firstname, I thought it would be the easiest way to sort.

Thanks in advance,

  1. 1 Posted by Ryan Griffith on 16 Jun, 2014 01:36 PM

    Ryan Griffith's Avatar

    Hi Lauren,

    My apologies for the incomplete response, I accidentally hit submit. Didn't have my morning coffee yes :)

    As I was saying, it looks like you are close, but may not be sorting the correct variable. When you have a moment, try the following:

    #set ($folderPages = $_XPathTool.selectNodes($contentRoot, "/system-index-block/system-page[name != 'index']"))
    $_SortTool.addSortCriterion("name", "", "text", "ascending", "") 

    Please let me know if you have any questions.


  2. 2 Posted by lauren.fraser on 16 Jun, 2014 02:22 PM

    lauren.fraser's Avatar


    That did the trick. Thanks!


  3. 3 Posted by Ryan Griffith on 16 Jun, 2014 02:23 PM

    Ryan Griffith's Avatar

    Thank you for following up, Lauren. I am glad to hear that did the trick.

    Have a great day!

  4. Ryan Griffith closed this discussion on 16 Jun, 2014 02:23 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac