cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Coopedup
Resolver II
Resolver II

Sort of distinct

I have a drop down which displays a SP List person column based upon the user type in another drop down (admin, owner etc.).  The problem is that despite no errors,  then sort makes no difference. 

 

Can anyone advise?

    Dropdown1.Selected.Value = "Owner",
    Sort(ForAll(Distinct(
       'SP Register'.'Owner',
       {  
           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
           DisplayName:'Owner'.DisplayName,
           Claims:'Owner'.Claims,   
           Email:'Owner'.Email
        }
    ),Result), Ascending)

 

1 ACCEPTED SOLUTION

Accepted Solutions
KvB1
Solution Sage
Solution Sage

I don't think you defined which column needs to be sorted to ascending. 

 

 

    Dropdown1.Selected.Value = "Owner",
    Sort(ForAll(Distinct(
       'SP Register'.'Owner',
       {  
           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
           DisplayName:'Owner'.DisplayName,
           Claims:'Owner'.Claims,   
           Email:'Owner'.Email
        }
    ),Result), Result, Ascending)

 

View solution in original post

3 REPLIES 3
v-albai-msft
Community Support
Community Support

Hi @Coopedup ,

How do you get the user type? What is the returned data type from your another dropdown? (Is the second dropdown with static values like "Owner", "admin"?)

Can you please more information with your scenario for helping me undertand your requirement(better with screenshots)?

I cannot fully understand your formula(why you use Forall() function). 

Best regards,

Allen

Coopedup
Resolver II
Resolver II

Hi Allen,

 

The fields I'm collecting names from are all SP List person or group fields and the "decision" drop down is a static value field as below.  If I select "Owner" I'm getting a unique list of names from my SP list Owners field, which is great. Though the order seems to match last update and I'd like to make it alphabetical.  As for using ForAll, no reason for it other than that's how I have it working and known no better!  What I didn't make clear in the example code above is that this sits within an If statement with 2 other SP list fields based on select role. I hope this helps?

 

Thanks for taking your time to look.  

[Blank(),"Owner", "Mitigation Owner", "Senior Sponsor"]

 

Coopedup_0-1626684620931.png

 

KvB1
Solution Sage
Solution Sage

I don't think you defined which column needs to be sorted to ascending. 

 

 

    Dropdown1.Selected.Value = "Owner",
    Sort(ForAll(Distinct(
       'SP Register'.'Owner',
       {  
           '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",  
           DisplayName:'Owner'.DisplayName,
           Claims:'Owner'.Claims,   
           Email:'Owner'.Email
        }
    ),Result), Result, Ascending)

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,904)