cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Need help with formatting syntax to remove staff from list

We have a SharePoint list that tracks staff members that have access to a particular website.  The PowerApp contains a Person field that pulls from AD.  As you type, the staff members appear in the choice list. We would like to Filter out those staff members that already have access granted to the website.  We have been struggling with the correct syntax.  Can anyone help with this?

"User SP List"  has a column "staff".  Only show those staff members that are not already in the the column "staff".

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Need help with formatting syntax to remove staff from list

Hi @Tracy1 ,

 

What is the data type of Staff column? Person?

 

First, you can collect all Office365Users to the collection, and add a column to show whether it is selected

Then, use ForAll function to traverse the list to determine whether has been selected.

After that, filter collection's item which isn't selected ,and set as the combo box items.

Finally,  modify the update property to submit the form.

 

please take the following as reference.

1. set the following formula to OnStart property of App to cache all staff members

ClearCollect(col,Office365Users.SearchUser({searchTerm:"",top:500}));
ClearCollect(colMembers,AddColumns(col,"IsSelected","No"))

 2. set the following formula to OnVisible property of form screen to determine those staff members that are not already in the the column "staff".

UpdateIf(colMembers,true,{IsSelected:"No"});
ForAll(Money,If(Staff.DisplayName in colMembers.DisplayName,Patch(colMembers,LookUp(colMembers,DisplayName=Staff.DisplayName),{IsSelected:"Yes"})))

3. set items property of combo box as below:

Filter(colMembers,IsSelected="No")

4. set update property of datacard as below:

{Claims:"i:0#.f|membership|" & DataCardValue6.Selected.UserPrincipalName,Department:"",DisplayName:DataCardValue6.Selected.DisplayName,Email:DataCardValue6.Selected.UserPrincipalName,JobTitle:"",Picture:""}

Annotation 2019-09-24 114519.pngHope this could help.


Best regards,

Sik

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Need help with formatting syntax to remove staff from list

Hi @Tracy1 ,

 

What is the data type of Staff column? Person?

 

First, you can collect all Office365Users to the collection, and add a column to show whether it is selected

Then, use ForAll function to traverse the list to determine whether has been selected.

After that, filter collection's item which isn't selected ,and set as the combo box items.

Finally,  modify the update property to submit the form.

 

please take the following as reference.

1. set the following formula to OnStart property of App to cache all staff members

ClearCollect(col,Office365Users.SearchUser({searchTerm:"",top:500}));
ClearCollect(colMembers,AddColumns(col,"IsSelected","No"))

 2. set the following formula to OnVisible property of form screen to determine those staff members that are not already in the the column "staff".

UpdateIf(colMembers,true,{IsSelected:"No"});
ForAll(Money,If(Staff.DisplayName in colMembers.DisplayName,Patch(colMembers,LookUp(colMembers,DisplayName=Staff.DisplayName),{IsSelected:"Yes"})))

3. set items property of combo box as below:

Filter(colMembers,IsSelected="No")

4. set update property of datacard as below:

{Claims:"i:0#.f|membership|" & DataCardValue6.Selected.UserPrincipalName,Department:"",DisplayName:DataCardValue6.Selected.DisplayName,Email:DataCardValue6.Selected.UserPrincipalName,JobTitle:"",Picture:""}

Annotation 2019-09-24 114519.pngHope this could help.


Best regards,

Sik

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,450)