0

I can't seem to figure out how to do a custom sort for an array (like an Excel Table) that sorts hierarchically by multiple columns, like sort by date then by time then by room.

The ODATA filter queries for the "List rows present in a table" Excel action seem to be very inconsistent, only allow a single query (so no chained sorts/filters) and really struggles with column names that have special characters and different cases.

I have tried using compose by chaining functions like sort(sort(sort(outputs('array')['body'],'date'),'time'),'room') but it just keeps the order of the last sort call disregarding all previous sorts.

Copilot mentions a "Sort array" action that does not seem to be available. Excel scripts are also not an option because my company has a limited Office 365 license.

Any ideas of how to do this?

2 Answers 2

1

For larger datasets I’d use an addProperty( ) expression in a Select to add a new column to the data with values set to a concat( ) concatenation of the multiple field values I want to sort on. (Date would need a new format of yyyyMMdd). Then you could sort on that new concatenation column.

Sign up to request clarification or add additional context in comments.

Comments

1

Power Automate does not support nested sorted by default. You can achieve it by manually sorting the array By using a combination of loops and filter array operations.

For instance: for a sample array that has objects with properties: time, room, date, you can use the following combination of steps for sorting them in a nested order.

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.