I have a flow which is getting data from a SharePoint list > Putting it in a HTML table > Compose > Sending it via email. The compose step has below expression to format the table. The list has a date and time column and I am trying to format the table according to it. Currently, it shows oldest item on top but i am trying to get the newest item on top. Any help would be greatly appreciated.
replace(body('IncidentTable'),'<table>','<table style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; width: 1250px ;border-collapse:collapse;padding :5px ;cellspacing :5px;border:2px solid #000;" border ="1" align="Left">')
Hi! I guess you are using 'Get items' action block to read your SP list, right?
If so, you can play with'Get items' 'Order by' input. LEt's imagine you need to show the results based on the date & time items were Created in descending order (newest first). THen you just need to type
If you wanna order your results by evaluating a different column, just replace 'Created' and use your target internal column name instead
Hope this makes sense
Thanks for your help. I tried this but it did not go through. I am getting error "Creating query failed.". I tried adding the internal name of the column and also adding it as a dynamic content but still the issue remains. Error is: The expression "2020-05-18T09:53:00Z desc" is not valid. Creating query failed.
here you go!
This is the internal name of the column:
I tried adding it with quotes 'Start_x0020_Time' but no luck. I tried adding it from Dynamic Contents as well still got the error.
Mmmm... your syntax is apparently correct, according to this thread
Did your 'Filter query' work before adding 'Order by'? Or, did you added both of them at the same time?
Are you sure of the internal column name? An easy way to verify it is to edit your flow, then add a Filter array just after your 'Get items', then select from Dynamic content menu the target column, then hover the mouse over it and this way Flow editor will show it.
Hope this helps
Check out the News & Announcements to learn more.
Participate in the Power Virtual Agents Community Challenge
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.