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

Filter SharePoint List in a ComboBox

Hello there ! this is my first post on this forum, I'm a newbie in PowerApps and I'm trying to make an app that allows users to make daily reports about their activities, I currently have a problem with the "Favorite Projects" page, basically there is a page where you select a Project and then click on a Button to confirm the change, as follows in details :

 

--> A gallery displays the list of projects that have been put into the FavProjectsList.

 

--> FavProjectsList, is a SharePoint list with 3 columns :

- Title, which I leave empty;

- User, is a person/group type column;

- Project, this is a LookUp type column that takes the project list from another SharePoint list.

 

--> To select the project and make the submit into the FavProjectsList there is an EditForm with 2 DataCards :

- User, which is always hidden and is by default the current user, set by this formula in the Default property

{
DisplayName:User().FullName;
Claims:"i:0#.f|membership|" & Lower(User().Email);
Department:"";
Email:User().Email;
JobTitle:"";
Picture:""
}

- Project, Required property is set to true and it's the only DataCard/ComboBox visible in this form, when you click it it shows you the list of all projects, here the Default property of the ComboBox 

Choices(FavProjectsList.columnProject)

 

--> Last thing there is a Confirm button that performs the following operations :

- In the OnSelect property

SubmitForm(editformFavProjects);;
Refresh(FavProjectsList);;
ResetForm(editformFavProjects);;
NewForm(editformFavProjects)

 

- DisplayMode property (it does disable the button if the combobox is empty, and makes it clickable

if a choice has been done)

If(IsBlank(DataCardValue20.Selected);
DisplayMode.Disabled;
DisplayMode.Edit)

 

Now the problem, I can select a project and add it to the favorite list, and I can do it again and again, how can I prevent the user from selecting more than 1 time the same project ?

 

I was thinking about making the DataCardValue20(combobox witht he projects list) to not show the projects that are already in the FavProjectsList, I tried putting this in the Items property of this combobox :

Filter(FavProjectslist.Project; Not(galleryFavProjects.Selected in FavProjectslist.Project))

 

But with this formula, the combobox shows a dropdown with the exact number of blank rows of how many projects are in the FavProjectsList, if I select one of these blank rows, the Confirm button doesn't get disabled, and I can click it and add a blank row in the gallery....rip

 

Thanks in advance for your suggestions/ideas/anything/whatever 🙂

2 REPLIES 2
Community Support Team
Community Support Team

Re: Filter SharePoint List in a ComboBox

Hi @ProNewbie ,

 

About "Filter(testPreferiti.Progetto; Not(galleryFavProjects.Selected in testPreferiti.Progetto))", can you please explain what are the parameters inside stands for? Like is testPreferiti the lookup column's source list name and what is Progetto's column type? "galleryFavProjects.Selected" should return a whole item but galleryFavProjects.Selected return a one-column's value. I do not think these 2 could compare successfully.

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ProNewbie
Level: Powered On

Re: Filter SharePoint List in a ComboBox

Hi @v-monli-msft, sorry I've forgot to translate some words of my code.

 

"Filter(testPreferiti.Progetto; Not(galleryFavProjects.Selected in testPreferiti.Progetto))"

is

"Filter(FavProjectslist.Project; Not(galleryFavProjects.Selected in FavProjectslist.Project))"

 

1)FavProjectsList is the SharePoint list which contains 3 columns :

- Title, this is the default column when you generate every SharePoint list, I always leave it empty;

- User, person/group type column;

- Project, LookUp type column that takes the list of all projects from another SharePoint list.

 

2)galleryFavProjects is the gallery which displays the names of the projects added in the

FavProjectsList using the form.

This is the code inside the galleryFavProjects.Items property :

// I'm sorting by the "Created" column which is a default/hidden column

// and I'm filtering for the _varCurrentUserMail variable

SortByColumns(Filter(FavProjectsList;

// _varCurrentUserMail is a global variable which contains the email address of the current user
_varCurrentUserMail in User.Email);"Created";

// Here I use an If to toggle ascending descending order, I act on this toggle with a button on

// this same screen, I would like to order by the Project(lookup type) column but this one is a minor issue.

If(SortDescending2; Ascending; Descending))

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,284)