cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gmaasz
Resolver I
Resolver I

Search for text in a table containing records in each row

I have a sharepoint list with a multiple select people picker field for users from different countries. In my app I want to check if the current user's name features in any of the records. I don't want to use the country to get the correct row and filter only one record, I wwant to run through all the table entries until it finds the name of the current user within one of the records.

 

I've tried everything I could find. Any help will be kindly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @gmaasz,

Do you want to check if the current user's name is existed within the Person field (Multiple selection) of all records of your SP list?

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

The Data structure as below:4.JPG

The App's configuration as below:5.JPG

 

6.JPG

Add a "Search" button within the screen of my app, set the OnSelect property to following:

Clear(ResultCollection);
ForAll(
     RenameColumns('20190104_case6',"ID","ID1"),
     If(
         User().Email in Executor.Email,    /* <- Executor is a Person column in my SP list, which enables "Allow multiple selections" option*/
         Collect(ResultCollection, LookUp('20190104_case6', ID=ID1))
       )
)

On your side, you should type:

Clear(ResultCollection);
ForAll(
     RenameColumns('YourSPList',"ID","ID1"),
     If(
         User().Email in YourPersonColumn.Email,
         Collect(ResultCollection, LookUp('YourSPList', ID = ID1))
       )
)

Or

Clear(ResultCollection);
ForAll(
     RenameColumns('YourSPList',"ID","ID1"),
     If(
         User().FullName in YourPersonColumn.DisplayName,
         Collect(ResultCollection, LookUp('YourSPList', ID = ID1))
       )
)

Add a Data Table control within the screen, set the Items property to following:

ResultCollection

Note: If the current user existed within the Person column of any record of your SP list, when you click "Search" button, it would display corresponding record within the Data Table.

Please check the attached GIF screenshot for more details:

 

Best regards,

Kris

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

4 REPLIES 4
xyzzyx666
Resolver I
Resolver I

Hi @gmaasz,

Do you want the gallery show all the list's items?

And then also filter the current user?

I make a test as next, and the SP list is as the screenshot:

country_currentuser1.png

And then I make one Gallery and set its TemplateFill:If(User().FullName=User,Blue)

it will show all the list's items and the current user maybe marked as different color.

country_currentuser2.png

No I dont want to use a gallery, I want to perform an action on click of a button, if the condition as met that the current user's name is found within the sharepoint list. I get it right when there is only one person per row, but I have multiple people in the same column of a row, making the value a record to evaluate. 

v-xida-msft
Community Support
Community Support

Hi @gmaasz,

Do you want to check if the current user's name is existed within the Person field (Multiple selection) of all records of your SP list?

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

The Data structure as below:4.JPG

The App's configuration as below:5.JPG

 

6.JPG

Add a "Search" button within the screen of my app, set the OnSelect property to following:

Clear(ResultCollection);
ForAll(
     RenameColumns('20190104_case6',"ID","ID1"),
     If(
         User().Email in Executor.Email,    /* <- Executor is a Person column in my SP list, which enables "Allow multiple selections" option*/
         Collect(ResultCollection, LookUp('20190104_case6', ID=ID1))
       )
)

On your side, you should type:

Clear(ResultCollection);
ForAll(
     RenameColumns('YourSPList',"ID","ID1"),
     If(
         User().Email in YourPersonColumn.Email,
         Collect(ResultCollection, LookUp('YourSPList', ID = ID1))
       )
)

Or

Clear(ResultCollection);
ForAll(
     RenameColumns('YourSPList',"ID","ID1"),
     If(
         User().FullName in YourPersonColumn.DisplayName,
         Collect(ResultCollection, LookUp('YourSPList', ID = ID1))
       )
)

Add a Data Table control within the screen, set the Items property to following:

ResultCollection

Note: If the current user existed within the Person column of any record of your SP list, when you click "Search" button, it would display corresponding record within the Data Table.

Please check the attached GIF screenshot for more details:

 

Best regards,

Kris

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.

I really appreciate the solution and effort that went in. Imressed with community response. Thanks

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (1,017)