web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Apps
Answered

Filtering Dropdown

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have Dropdown that autopopulates the User's Location. The Dropdown has the following conditions:

 

DisplayMode:

If(varHierarchy="National" Or varHierarchy="Region" = true,DisplayMode.Edit,Disabled)

 

DefaultSelectedItems:

Filter(SortByColumns(ParkListCollection.Park, "Title", Ascending), Title = varParkAlpha)

 

Items:

ParkListCollection

 

Currently all the above default the Dropdown to the Member's location. If the Member ProgramHierarchy is 'Park' or 'Employee' the Dropdown is disabled; if the Member's ProgramHierarchy is 'Region' and 'National' they can change the Dropdown.

 

I would like to add a condition that says also 'If the Member in the UserName field is ProgramHierarchy is 'Region' the Member shall ONLY be able to see Locations in their 'Region' in the Dropdown (both the ParkListCollection and the MemberListCollection have a column titled 'NPSRegion'; and the MemberListCollection has a column titled ProgramHierarchy); anyone whose name appears in the UserName field with a ProgramHierarchy of 'National' can see all Locations.

 

3csman_0-1608488707048.png

 

Categories:
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    Could you tell me:

    1. Could you provide a complete data source structure?
    2. Which columns mentioned in this article are in ParkListCollection and which are in MemberListCollection?

     

    I am sorry could you provide more details? And I will happy to answer your questions.

    Looking forward to your reply.

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Please see below.

     

    UniqueID - company created from Member name and predetermined numbers: Looks like AA1234 (Member List)
    UserName - from Active Directory (Member List)

    Park (both Lists)

    NPSRegion (both Lists)

    ProgramHierarchry (Member List)

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

     

    According to your description, the point it the Items property of dropdown control.

    You could use If() function to set the items value of the dropdown control.

    Please try this on the Items property of dropdown control:

    If(your ProgramHierarchy = 'Region', the Items(in ParkListCollection) you have filtered, ParkListCollection)

     

    Best Regards,

    Wearsky

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    That part I can do.

     

    What I need is a multiple-condition statement that says -


    1. If the Member in the UserName field is ProgramHierarchy "Employee" default to show the Member's name ONLY in the Dropdown - they should not have access to any other names;

     

    2. If the Member in the UserName field is ProgramHierarchy "Park" default to show the Member's name in the Dropdown and provide the Member access to All other Member names assigned to THAT Park ONLY in the Dropdown;

     

    3. If the Member in the UserName field is ProgramHierarchy "Region" default to show the Member name in the Dropdown and provide the Member access to ALL OTHER Member names in THAT Region only;

     

    4. If the Member in the UserName field is ProgramHierarchy "National" default to the Member's name in the Dropdown and provide access to ALL NAMES regardless of location

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Have you had a look at the Switch-function? Something like this in the Items property might help:

    Switch(
    	varHierarchy,
    	"Employee", [Filter ParkListCollection to only return Employee],
    	"Park", [Filter ParkListCollection to only return same Park],
    	"Region", [Filter ParkListCollection to only return same Region],
    	"National", [Return the whole ParkListCollection]
    )

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Let me try this from another angle...

     

    I've got the following in the properties of the Main screen No. 1 Dropdown.

     

    It currently defaults to the Dropdown the Park to which the member whose name defaults into the UserName field (from the active directory) is assigned.

     

    If the Member has a hierarchy of 'Employee' or 'Park' the Dropdown DisplayMode is 'Disabled'. For everyone else the Dropdown is 'Edit'. 

     

    I'd like to add to all this the additional conditions of:

     

    If the hierarchy of the User whose name appears in the UserName field is 'Region' that Member (who already has 'Edit' access to the Dropdown - should only see in the Dropdown parks from their 'Region'.  

     

    DisplayMode
    If(varHierarchy="National" Or varHierarchy="Region" = true,DisplayMode.Edit,Disabled)

    DefaultSelectedItems
    Filter(SortByColumns(ParkListCollection.Park, "Title", Ascending), Title = varParkAlpha)

    Items
    ParkListCollection

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Okay, let me describe how I read the setting to make sure I don't misunderstand.

     

    1. It is all about a single dropdown (say, DropDown1).
    2. Possible users have one of four different hierarchies.
    3. Hierarchy = "National" or "Region" ==> DropDown1 is enabled (else disabled)
    4. Hierarchy = "Region" ==> User should only see certain Parks (i.e., the list of selectable elements in the dropdown is filtered) 
    5. The default values are currently working as intended
    6. Hierarchy = "Employee" or "Park" ==> The list of items in the dropdown do not matter, because the user cannot access it/interact with it and the defaults are set as intended (see 5.)

    If the above is true, can you please explain, why setting a conditional filter ("If" or "Switch") in the items property does not accomplish what you desire?

    If the above is not true, can you please explain where I misunderstood?

     

    Also a side note: Could it be that you are using a combobox control, rather than a dropdown control? (Dropdowns do not have the property "DefaultSelectedItem" but comboboxes do)

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Please see my replies below, in Blue

     

    1. It is all about a single dropdown (say, DropDown1). - Correct; the Main screen Dropdown; the content of which (their Location) is derived from the member name that defaults into the UserName (retrieved from the active directory at app start)
    2. Possible users have one of four different hierarchies. - Correct
    3. Hierarchy = "National" or "Region" ==> DropDown1 is enabled (else disabled) - Correct;
    4. Hierarchy = "Region" ==> User should only see certain Parks (i.e., the list of selectable elements in the dropdown is filtered) - Correct; This is the only real change to the existing condition. All names that default into the UserName field are to be evaluated. If the member has a Hierarchy of 'Region', the Box should be DisplayMode.Edit (already established), and the content of the Box should only contain Locations in that members 'NPSRegion'. Both lists have columns titled 'Park' and 'NPSRegion'. Member and UserName columns are only on the Member List, not the Park List.
    5. The default values are currently working as intended - Correct; DisplayMode.Edit for 'Region' and 'Nationa', Disabled for 'Park' and 'Employee'. Also, Box currently defaults to the Location of the UserName.
    6. Hierarchy = "Employee" or "Park" ==> The list of items in the dropdown do not matter, because the user cannot access it/interact with it and the defaults are set as intended (see 5.) - Correct;

    If the above is true, can you please explain, why setting a conditional filter ("If" or "Switch") in the items property does not accomplish what you desire? - It is not my assertion that 'If' or 'Switch' won't work; I simply lack the experiential knowledge to correctly formulate the proper condition(s). Which is why I am talking to you (and the forum).😁

     

    If the above is not true, can you please explain where I misunderstood? - You understand perfectly.

     

    Also a side note: Could it be that you are using a combobox control, rather than a dropdown control? (Dropdowns do not have the property "DefaultSelectedItem" but comboboxes do) - See, you do understand; yes, you are correct; I misspoke the control IS a ComboBox. It needs to be searchable, as there are some 400 locations. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @AnonymousSorry for the late reply due to the holidays. Have you found a solution in the meantime?

     

    Regarding your last post:


    @Anonymous wrote:

    If the above is true, can you please explain, why setting a conditional filter ("If" or "Switch") in the items property does not accomplish what you desire? - It is not my assertion that 'If' or 'Switch' won't work; I simply lack the experiential knowledge to correctly formulate the proper condition(s). Which is why I am talking to you (and the forum).😁 


    It is hard to write the exact code without knowing the namings of you tables/columns but let me try (it is basically the same thing @v-xiaochen-msft wrote.

     

    Items:

    If(varHierarchy="Region", Filter(ParkListCollection, Region = ThisUserRegion),ParkListCollection)

     

    In above code, [Region] is the column that contains the information about the Region in [ParkListCollection] and [ThisUserRegion] refers to the region that is assigned to the user using the app. Since the combo box is disabled for the hierarchies "Park" and "Employee" anyways, they don't need a filter.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    No problem with the delay; thank you for prioritizing your seasonal health and well-being over this forum. 🤣

     

    The proposed condition kicked back errors.

     

    I am hierarchy 'National'. This updated condition returns the complete list ascending, but does not default my home park name (the User's home park) into the ComboBox, as the original condition does.

     

         If(varHierarchy="Region", Filter(ParkListCollection, "NPSReg" = varNPSReg),ParkListCollection)

     

    Also, when I change my hierarchy to 'Region' in the MemberCollection and refresh, the ComboBox does not auto-populate my home park, but does list all parks once opened.

     

    Here is additional information, that I hope will clarify some things.

     

    The data sources are (SharePoint):

       ParkSnapShotCollection (Columns: Title (=Park), NPSReg)

       ParkListCollection (Columns: Title (=Park), NPSReg)

       MemberCollection (Columns: Park, NPSReg)

     

    I've got these running on AppStart:

     

    Set(varNPSRegion, false );
    Set(varDOIRegion,0);
    Set(varIsRoster, false );
    Set(varParkAlpha,"");
    Set(varNPSReg, "");
    Set(varProgramHierarchy,"");

     

    Set(varIsHierarchyEmployee, false );
    Set(varIsHierarchyPark, false );
    Set(varIsHierarchyRegion, false );
    Set(varIsHierarchyNational, false );

     

    Set(varParkAlpha,First(Filter(MemberCollection,UsrNm=User().FullName)).Park);
    Set(varNPSReg,First(Filter(MemberCollection,UsrNm=User().FullName)).NPSReg);
    Set(varHierarchy,First(Filter(MemberCollection,UsrNm=User().FullName)).ProgramHierarchy);

    Set(MemberUnqID,LookUp(MemberCertificationandQualificationCollection,UsrNm=User().FullName).UnqID);
    Set(HierarchyPark,LookUp(MemberCertificationandQualificationCollection,UsrNm=User().FullName).Park);
    Set(HierarchyRegion,LookUp(MemberCertificationandQualificationCollection,UsrNm=User().FullName).NPSReg);
    Set(HierarchyLevel,LookUp(MemberCollection,UnqID=UnqID).ProgramHierarchy);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard