In my Planner plan in Teams I have 4 buckets in this order:
In my PowerApp I have a Gallery and I want the buckets to be listed in the same order so i used the following function. Note the sequence is not the same as above, but if I use Excel to sort by orderHint, Excel agrees with the following sequence! But that is not what is in the Plan! Note that "Waiting" and "Completed" are swapped compared to Teams.
PS: here is the table of orderHints, sorted Descending.
I have also run the query directly in the Graph Explorer to confirm the orderHint values and they are the same as above so my connector is returning the correct data. And, the sequence of records is the correct reverse order which seems is the default "sort order" ie Completed, Waiting, Started, To do.
If I do NOT attempt to sort the collection by simply running this:
the records are returned in the correct order (the same as the Graph Explorer results) mentioned above: Completed, Waiting, Started, To do.
So, SortByColumns() on the orderHint sorts in the "correct" collating sequence as verified by sorting them in Excel, but that order is NOT the reverse of the sequence returned by Graph (or my connector).
All I want to do is list my buckets in the same sequence as they appear (left to right) in the Plan.
Hi @murrah ,
Do you want to sort the table based on this order:Completed, Waiting, Started, To do
If so, I suggest you use Sort function instead of SortByColumns, because you could customize sort rule in Sort function.
Try this formula:
Sort(PlannerCustoemer.ListPlanBuckets("Eh....").value, If(name="Completed",1,name="Waiting",2,name="Started",3,name="To do",4), Ascending)
Then the table will sort as this order:Completed, Waiting, Started, To do
Here's a doc about this function for your reference:
However, that does not address the underlying issue. For a start, it is not translatable to other Plans where the list of buckets will have different names. It will also break if a user changes the bucket name.
The bucket record has an orderHint property. When you sort on that property it sorts/collates correctly (as far as I can see) but that sequence is not the same as the buckets appear in the Plan UI. Graph is returning the buckets in the correct DESC order. I just need to reverse that without resorting to copying the items to another collection in reverse order. I assumes the orderHint would do that but it seems not.
So, how do I get a list of buckets that is in the same sequence as that in the Plan UI? I need a solution that will work for any Plan, not something hard coded that will break.
Check out our new profile badges recognizing authored solutions!
We are excited to announce the Power Apps Super Users!
Did you miss the call? Check out the Power Apps Community Call here.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!