web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Gallery Search and ForAll
Power Apps
Unanswered

Gallery Search and ForAll

(0) ShareShare
ReportReport
Posted on by 47

Hi,

I am trying to create a gallery search with ForAll. The ForAll code helps me to remove duplicate items in the SharePoint list which I need to operate. Also, I want to add search function to look for. 

This code is located in gallery items:

 

 

 

 

ForAll(
 Distinct(
 'SharepointList',
 Name
 ),
 LookUp(
 'SharepointList',
 Name = Result
 )
)

 

 

 

 

I want to add to this code a search value and I have a problem connecting it to ForAll, please let me know if this is possible somehow:

 

 

 

 

Search('SharepointList', TextInputSearch.Text, "Name")

 

 

 

 

Both codes work as they should be only they need to be separated, when I want to add them together using  "; " I have an error: we expecting operators such as "+" or "&" at this point, 

 

 

Thanks for help or a different solution

 

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @SevenWishes ,

     

    The Items property will only take a single command, so you have to nest the commands. For that I would use a filter:

     

    Filter(
    	ForAll(
    		Distinct(
    			'SharepointList',
    			Name
    		),
    		LookUp(
    			'SharepointList',
    			Name = Result
    		)
    	),
    	If(
    		!IsBlank(TextInputSearch.Text,
    		TextInputSearch.Text In Name,
    		true)	
    )

     

    Disclaimers:

    You may want to change the expression in the filter command as "In" is not delegable.

    I didn't have time to test the above, this is just what I think it should look like.

  • Verified answer
    CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @SevenWishes ,

    I'm not sure that is the right approach as sending a large number of queries to SharePoint for each lookup function call will affect the app responsiveness:

    ForAll(
     Distinct(
     Filter('SharepointList',StartsWith(Name,TextInputSearch.Text)),
     Name
     ),
     LookUp(
     'SharepointList',
     Name = Result
     )
    )

    Please note that the Search() function is not delegable to SharePoint and you will get an warning. 

    To help you optimize the app, I need more details about the app scenario.

    Hope it helps !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard