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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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:
  • BCBuizer Profile Picture
    22,854 Super User 2026 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,272 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard