cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kristinegriba
Advocate I
Advocate I

Dropdown from Sharepoint list, based on conditions

I have a Sharepoint list called LISTbtsusers. See below for a screen capture of the list content simulated in Excel to give you the idea.

 

Capture199.JPG

 

In my PowerApps app, I have a dropdown that will be used to filter a gallery. I want that dropdown to display the data in column userFullName based on 'yes' in two columns: userPrimary and userBookkeeper. In other words, the dropdown data should be:

 

Capture200.JPG

 

The code I've used for the dropdown's "Items", which seems to be working thus far but with one exception, is as follows:

 

AddColumns(LISTbtsusers, "HybridWorker", If(userPrimary.Value = "Yes" Or userBookkeeper.Value = "Yes",userFullName))

 

The 'one exception' is that the dropdown has empty rows; see the screen capture:

 

Capture201.JPG

Note that the empty rows in the screen capture reflect my actual data versus the mock data I have used above for the purposes of this question.

 

My question: How do I eliminate the blank rows? Or filter them out? Or something?

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
BCBuizer
Super User
Super User

Hi @kristinegriba ,

 

First apply the filter and then add the columns:

 

AddColumns(
	Filter(LISTbtsusers, userPrimary.Value = "Yes" Or userBookkeeper.Value = "Yes"),
	"HybridWorker",
	userFullName
)

 

Currently you are adding a column to all items, but only populate it for users that meet the criteria.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

View solution in original post

4 REPLIES 4
BCBuizer
Super User
Super User

Hi @kristinegriba ,

 

First apply the filter and then add the columns:

 

AddColumns(
	Filter(LISTbtsusers, userPrimary.Value = "Yes" Or userBookkeeper.Value = "Yes"),
	"HybridWorker",
	userFullName
)

 

Currently you are adding a column to all items, but only populate it for users that meet the criteria.



Did you like my post? Please give it a thumbs up! Did I resolve your issue? Please click Accept as Solution to close the topic and so other members of the community can find solutions more easily.

@BCBuizer That worked beautifully, thank you!

Actually, one more question, if I wanted to sort the names alphabetically, would it look something like this?

 

AddColumns(
     Sort(
          (Filter(LISTbtsusers, userPrimary.Value = "Yes" Or userBookkeeper.Value = "Yes"), "HybridWorker", userFullName),

     userFullName, Ascending)
)

 

So like Filter, Sort should stay 'inside' AddColumns?

Actually, I put the Sort outside the AddColumns and that seemed to work better

 

Sort(
     AddColumns(
         Filter(LISTbtsusers, userPrimary.Value = "Yes" Or userBookkeeper.Value = "Yes"), "HybridWorker", userFullName),

userFullName, Ascending

)

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,271)