cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NewNW
Level: Powered On

Dropdown list based on Sharepoint list Items

Hi ,

 

I want to assign drop down items to a drop down list from a SharePoint list, I have used following to split the site column as in SharePoint list the data stored as a single string separated by a comma.

es Sharepoint list site column- > Site1,Site2,Site3

I want to display in dropdown ->Site1

                                                     Site2

                                                     Site3

I m checking the current logged in user and get the relevant sites, Only one item will have in Sharepoint list for one particular user .

I have done the follwing but, ?Im getting the empty display on dropdown. 


Distinct(DriverRegistrationList,TrimEnds(Split((LookUp(DriverRegistrationList,Email=User().Email,Sites)),",")))

site1.png

But when i do this I can see the sites as a one string 

Distinct(DriverRegistrationList,LookUp(DriverRegistrationList,Email=User().Email,Sites))

site.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Dropdown list based on Sharepoint list Items

Hi @NewNW ,

Could you please share a bit more about the Email column in your SP list? Is it a Single line text type column?

Could you please show more details about the DriverRegistrationList that you mentioned? Is it the SP list data source within your app?

 

I assume that the Email column is a Single line text type column in your SP list, based on the formula that you provided, I think there is something wrong with it.

I also found that you have submitted similar issue within this forum, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Adding-drop-down-items-based-on-the-login-use...

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the Items property of the ComboBox to following formula:

Split(
TrimEnds(LookUp(DriverRegistrationList, Email=User().Email, Sites)),
","
)

 

If the Email column is a Person column in your SP list, please take a try with the following workaround:

Set the OnStart property of the App control or OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, DriverRegistrationList)

Set the Items property of the Site ComboBox to following:

Split(
      TrimEnds(LookUp(RecordsCollection, Email.Email = User().Email, Sites)),
      ","
)

Please take a try with above solution I provided, check if the issue is solved. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

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

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Dropdown list based on Sharepoint list Items

@NewNW 

I am not clear on if there will be multiple items in the list that will match the criteria and if you want all of those to appear in the dropdown.  So, I will propose two solutions for you.

 

Solution 1 - The SharePoint list will only have one record that will satisfy the condition Email=User().Email

This is relatively straight-forward. You get one result back from the list and you want to split the column called Sites and display in the dropdown list.

Your formula for your Items Property on your DropDown control will be this:

Distinct(
TrimEnds(
Split(
LookUp(DriverRegistrationList,Email=User().Email).Sites,
",")
)
)

I'm not entirely sure that you need the Distinct function here, but since you mentioned it, I will assume that the resultant split of Site names could possibly contain duplicate information.

 

 

Solution 2 - The SharePoint list will have multiple records that will satisfy the condition Email=User().Email

This is slightly trickier as you need to employ the use of a Collection to "pre-build" your list.

 

In this solution we need to put a formula somewhere (like OnVisible of the Screen, or someplace where we need the values in the list to change).

That formula would be the following:

Clear(colSiteList);
ForAll(
          Filter(DriverRegistrationList, Email=User().Email), 
          Collect(colSiteList, 
                      TrimEnds(
                                      Split(Sites,",")
                                     )
                      )
          )

The Items Property on your DropDown control would be this:

   Distinct(colSiteList, Result)

 

 

I hope this is helpful for you and is what you are looking for.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Community Support Team
Community Support Team

Re: Dropdown list based on Sharepoint list Items

Hi @NewNW ,

Could you please share a bit more about the Email column in your SP list? Is it a Single line text type column?

Could you please show more details about the DriverRegistrationList that you mentioned? Is it the SP list data source within your app?

 

I assume that the Email column is a Single line text type column in your SP list, based on the formula that you provided, I think there is something wrong with it.

I also found that you have submitted similar issue within this forum, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Adding-drop-down-items-based-on-the-login-use...

 

Based on the needs that you mentioned, I have made a test on my side, please take a try with the following workaround:

Set the Items property of the ComboBox to following formula:

Split(
TrimEnds(LookUp(DriverRegistrationList, Email=User().Email, Sites)),
","
)

 

If the Email column is a Person column in your SP list, please take a try with the following workaround:

Set the OnStart property of the App control or OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, DriverRegistrationList)

Set the Items property of the Site ComboBox to following:

Split(
      TrimEnds(LookUp(RecordsCollection, Email.Email = User().Email, Sites)),
      ","
)

Please take a try with above solution I provided, check if the issue is solved. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

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

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,461)