cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Continued Contributor
Continued Contributor

Updating all records where people field doesn't match

So I have a gallery (GalleryHome) which is filtered to display records from the data source (Records) and created by the logged in user.

All the records have a Supervisor column which is a multi-select people column.

I am assuming that the Supervisor field of the last record in this gallery is the most up-to-date one and want to update all other records where there isn't a match at the click of a button.

So even if the last supervisor field is 'Person A', 'Person B' and there is another record which is 'Person B', 'Person A', that second record should still be identified as not a match and be updated.

 

I guess I can use a ForAll and UpdateIf for the update, but the problem is comparing the columns when they are considered tables. I've tried creating both a variable and a collection using Last(GalleryHome.AllItems.AcademicSupervisor) but the problem remains of creating a condition where they can be compared or records filtered.

 

Any ideas please?

1 ACCEPTED SOLUTION

Accepted Solutions
calvares
Continued Contributor
Continued Contributor

Thanks @BCLS776 . I knew about the concat for multi-select people fields but had a complete brain block yesterday!

This is the formula I used and it has worked:

Set(varLast, Last(GalleryHome.AllItems.AcademicSupervisor));
ClearCollect(colToUpdate, Filter(GalleryHome.AllItems, Not(Concat(varLast.AcademicSupervisor, Claims, "; ") = Concat(AcademicSupervisor, Claims, "; "))));
ForAll(RenameColumns(colToUpdate, "ID", "NewID"),
UpdateIf(Records, ID = NewID, Last(GalleryHome.AllItems.AcademicSupervisor)))

 

View solution in original post

5 REPLIES 5
BCLS776
Super User
Super User

Try this Filter() to get at the records with a particular user name in them:

 

Filter(GalleryHome.AllItems,
    Label1.Text in // This label contains your name search string
    AcademicSupervisor.DisplayName // AcademicSupervisor is a people type column
)

You can substitute User().FullName for Label1.Text to query for the currently logged in user, or even hard code a search string such as "Richard"

 

Is that what you are after?

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Oh, and for a Person column with multiple choices enabled, use this:

 

Filter(GalleryHome.AllItems,
    Label1.Text in // This label contains your name search string
    Concat(AcademicSupervisor.DisplayName, DisplayName) // AcademicSupervisor is a multi-people type column
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
calvares
Continued Contributor
Continued Contributor

Thanks @BCLS776 . I knew about the concat for multi-select people fields but had a complete brain block yesterday!

This is the formula I used and it has worked:

Set(varLast, Last(GalleryHome.AllItems.AcademicSupervisor));
ClearCollect(colToUpdate, Filter(GalleryHome.AllItems, Not(Concat(varLast.AcademicSupervisor, Claims, "; ") = Concat(AcademicSupervisor, Claims, "; "))));
ForAll(RenameColumns(colToUpdate, "ID", "NewID"),
UpdateIf(Records, ID = NewID, Last(GalleryHome.AllItems.AcademicSupervisor)))

 

View solution in original post

Wonderful! If your problem is solved, could you "accept a solution" so that others can benefit? It helps make the topic more searchable.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
v-albai-msft
Community Support
Community Support

Hi @calvares ,

Glad that you have solved your issue. I will mark you reply as a solution so that other community members who stuck with the same question can directly see your answer.

Best regards,

Allen

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (3,136)