Using the new Power Automate sort expression in my Daily Gift Report
Hi All, I am trying to add the new sort expression to my existing Daily Gift Report automation. I am able to get the reverse expression to work, but when I change reverse to sort, I get an error of internal server error. Does anybody have an idea of what I am doing wrong?
Comments
-
Hi Amy- I have this in my List Gifts- it sorts by descending dollar amount and works well.
Sorted by -amount
-Carolyn Grant
1 -
@Carolyn Grant Thank you so much for the information. I will try it now ?
0 -
@Carolyn Grant and @Amy Pierzchala - do ya'll want to share a bit about this at our upcoming Power Automate user group on 10/25? I bet others are struggling here, too.
0 -
@Heather McLean Hi Heather- I would be glad to share but all I did was look at the API reference for List Gifts and the sort field had this info:
Represents a list of fields to sort the results by. Returns a list that sorts gifts based on the supplied fields. Results are in ascending order by default, and a '-' sign denotes descending order. For example, "sort=date_added,-date" sorts gifts by the "date_added" field in ascending order and then by the "gift date" field in descending order. If only the date_modified field or only the date_added field is provided, then this adds the sort_token parameter to the next_link URL to ensure that gifts are stably sorted.
0 -
Hi Carolyn, I don't see Sorted by in my Blackbaud RE NXT connector “List gifts”. What connector and action are you using to get that option?
Thanks! Amy
0 -
Here is a screen shot of what I see:
0 -
@Amy Pierzchala I had the same issue, but found that the sort by option is part of the Gifts connector. You and I were using the older/general NXT connector.
0 -
@Amy Pierzchala
I think you've already found a better solution to your problem, but if you're still curious why you were getting an Internal Service Error when trying to sort your results, it's most likely because you are sorting an array of objects without telling Power Automate which property to sort by.When you sort a normal array, all you need to do is tell sort() which array you want to sort, so your expression would look like this: sort(variables('Array'))
However, if you are sorting an array of objects, you also have to tell it which property you want to sort based on. In the case of List Gifts, you might want to sort by id or by date_added. You can do this with expressions like these:
sort(outputs('List_gifts')?['body/value'],'id')
sort(outputs('List_gifts')?['body/value'],'date_added')
There are some limitations here, which is why I think you're better off using the solution from Carolyn and Dan. The first limitation is that, if you have, say, 50,000 gifts in your database, sort() is only going to sort the 500 or so that are returned to Power Automate. So if you want to see the first 10 gifts ever made to your org, sort() isn't a good way to go about it.
Second, sort() can only sort by properties that are one level deep. This is an example of some output from List Gifts:
You can see that “id” is in the first level of the object (and therefore you can sort by it), but the Acknowledgement Status is an array of objects within the gift object. This means you can't easily sort by acknowledgement status using sort(). And gift value is also an object within an object, so no sorting by that, either!
Generally it's best to sort the data before bringing it into Power Automate when you can, and the option that Carolyn and Dan highlighted does just that. But hopefully this will help if you need to use sort() in the future.
1 -
@Ben Regier
Thank you, Ben, for explaining this to me. It is helped me understand the pieces that were driving me bonkers about why I couldn't figure out how to use the formula. Thank you again!0 -
@Dan Snyder
Thank you for helping me find the right connector. I did wonder if that was my problem, but I didn't want to mess with my automation without the confirmation ?0 -
@Carol Grant
Sorry to reply to an old thread, but how do you get the Added on: filter to work? It seems to ignore that when it runs.0 -
@Craig Bruno
Assuming you are using Constituent List or Gift List actions, if you specified the “list” option to use a RE NXT list as your basis for getting records, then all other options are not going to be honored.If you must use a gift list as basis, then use power automate sort expression to sort the values property from List gifts and use that in the apply to each loop:
sort(outputs('List_gifts')?['body/value'], 'date_added')
sort() expression will sort ascending order, if you want descending order, use reverse() on the sort()
reverse(sort(outputs('List_gifts')?['body/value'], 'date_added'))
1
Categories
- All Categories
- 6 Blackbaud Community Help
- High Education Program Advisory Group (HE PAG)
- BBCRM PAG Discussions
- Luminate CRM DC Users Group
- DC Luminate CRM Users Group
- Luminate PAG
- 186 bbcon®
- 1.4K Blackbaud Altru®
- 389 Blackbaud Award Management™ and Blackbaud Stewardship Management™
- 1K Blackbaud CRM™ and Blackbaud Internet Solutions™
- 14 donorCentrics®
- 355 Blackbaud eTapestry®
- 2.4K Blackbaud Financial Edge NXT®
- 616 Blackbaud Grantmaking™
- 542 Blackbaud Education Management Solutions for Higher Education
- 33 Blackbaud Impact Edge™
- 3.1K Blackbaud Education Management Solutions for K-12 Schools
- 909 Blackbaud Luminate Online® and Blackbaud TeamRaiser®
- 207 JustGiving® from Blackbaud®
- 6.2K Blackbaud Raiser's Edge NXT®
- 3.5K SKY Developer
- 236 ResearchPoint™
- 116 Blackbaud Tuition Management™
- 375 YourCause® from Blackbaud®
- 160 Organizational Best Practices
- 232 The Tap (Just for Fun)
- 31 Blackbaud Community Challenges
- Blackbaud Consultant’s Community
- 19 PowerUp Challenges
- 3 Raiser's Edge NXT PowerUp Challenge: Gift Management
- 4 Raiser's Edge NXT PowerUp Challenge: Events
- 3 Raiser's Edge NXT PowerUp Challenge: Home Page
- 4 Raiser's Edge NXT PowerUp Challenge: Standard Reports
- 4 Raiser's Edge NXT PowerUp Challenge #1 (Query)
- 71 Blackbaud Community All-Stars Discussions
- 47 Blackbaud CRM Higher Ed Product Advisory Group (HE PAG)
- 743 Community News
- 2.8K Jobs Board
- Community Help Blogs
- 52 Blackbaud SKY® Reporting Announcements
- Blackbaud Consultant’s Community
- 19 Blackbaud CRM Product Advisory Group (BBCRM PAG)
- Blackbaud Francophone Group
- Blackbaud Community™ Discussions
- Blackbaud Francophone Group