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.
Que???
Any ideas?
Thanks,
Murray
PS: here is the table of orderHints, sorted Descending.
8586369754989763017P_ | To do |
85862x/ | Started |
85862Ss | Completed |
85862q* | Waiting |
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:
PlannerCustomConnector.ListPlanBuckets("Ehibn5WSkkaHVqAgLvGCkggAFIx-").value
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.
Thanks.
Hi @Anonymous ,
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:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort
Best regards,
Thanks.
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.
Thanks,
Murray
User | Count |
---|---|
122 | |
87 | |
86 | |
75 | |
67 |
User | Count |
---|---|
214 | |
181 | |
137 | |
96 | |
83 |