cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Listing Planner buckets by orderHint - not the same sequence as in Planner Plan

In my Planner plan in Teams I have 4 buckets in this order:

Greenshot 2019-12-16 17.35.10.png

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.

Greenshot 2019-12-16 18.13.14.png

Que???

 

Any ideas?

 

Thanks,

Murray

3 REPLIES 3
Highlighted
Helper I
Helper I

PS: here is the table of orderHints, sorted Descending.

8586369754989763017P_To do
85862x/Started
85862SsCompleted
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.

Highlighted

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:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort

 

 

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted

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

 

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,270)