Nested Sort expression for HTML table?

I’m working on my very first flow and I’m using Haillie Guiseppe’s Overdue Action Audit from the template showcase (thank you, @Hallie Guiseppe!).

The flow is working perfectly, except I’d like to sort the resulting HTML table first by fundraiser and then by action due date, so the resulting table would look like this:

image-1f2750f9f52be8-c053.png

Using the Sort expression, I can sort by either fundraiser OR action due date, but not by one followed by the other.

If I use the Sort expression like this, the result is sorted by fundraiser of course:

image-97ebeac98797b-f436.png

If I nest the Sort expressions like this, the result is only sorted by action due date without regard to fundraiser:

image-9a318d0baa3ba8-6919.png

Last, I tried swapping the order of the nested sort expressions like this, and the result is only sorted by fundraiser.

image.png

Any advice on how to sort first by one field, then by another?

Best Answer

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 Facilitator 3 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge
    Answer ✓

    sort() expression does not allow sorting by multiple fields, and nesting wouldn't do it as it simply will sort by fundraiser, and THEN sort by due date, the outer most sort() expression will be the result.

    One way to do what you want to do is to create a sortkey that is a combination of the field you want to sort by. This is done via Select action, and then use sort() expression.

    image.png

    Then you can do sort(body('Select'), 'sortkey')

    in your case, you want the sortkey to be fundraiser name (if you want and have the data for it, you can do fundraiser lastname then firstname, then duedate) and the due date. However, just be aware that a sortkey is going to need your date to be in yyyymmdd format to better do sorting

Answers

  • Dan Snyder
    Dan Snyder Community All-Star
    Tenth Anniversary Kudos 5 Raiser's Edge NXT Fall 2025 Product Update Briefing Badge First Reply
    edited October 20

    Might want to take a look at these two discussions:

    1. https://community.blackbaud.com/discussion/comment/270933#Comment_270933?utm_source=community-search&utm_medium=organic-search&utm_term=sort
    2. https://community.blackbaud.com/discussion/comment/305729#Comment_305729?utm_source=community-search&utm_medium=organic-search&utm_term=sort
  • Thank you, Dan and Alex, for taking the time to respond. I'll check out these ideas. Appreciate the help!