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?
Solved! Go to Solution.
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)))
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?
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
)
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)))
Wonderful! If your problem is solved, could you "accept a solution" so that others can benefit? It helps make the topic more searchable.
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
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
187 | |
52 | |
51 | |
34 | |
33 |
User | Count |
---|---|
266 | |
97 | |
84 | |
77 | |
73 |