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 / Search not working pro...
Power Apps
Answered

Search not working properly in gallery

(0) ShareShare
ReportReport
Posted on by 603
I have a powerapps canvas app with sharepoint as the datasource. I noticed that search is working fine, however returning some blank results as well, which should not happen.
 
I suspect its due to the ForAll function in Items property of the code. May i know where i am going wrong?
 
Items Property of Gallery
With(
    {
        uniqueID: ForAll(
            Distinct(
                Filter(
                    'Events',
                    Start_Date_and_Time > Now()&& Status = "Active"
                ),
                EventUniqueID
            ),
            {Result: ThisRecord.Value}
        )
    },
    Sort(
        ForAll(
            uniqueID As CurrentID,
            First(
                Sort(
                    Filter(
                        'Events',
                        (Len(RegSearch_2.Text) = 0 || RegSearch_2.Text in Title)&&EventUniqueID = CurrentID.Result && Start_Date_and_Time > Now()
                    ),
                    Start_Date_and_Time,
                    SortOrder.Ascending
                )
            )
        ),
        Start_Date_and_Time,
        SortOrder.Ascending
    )
)
 
Screenshot of Gallery when searched 
 
It should show only the first box which has data and other box which are blank should be hidden when searched
 
Categories:
I have the same question (0)
  • abc 123 Profile Picture
    789 Moderator on at
    Far too complicated. Break down to just a couple of collections.
  • Iantaylor2050 Profile Picture
    603 on at
    Hi @WarrenBelz
     
    Could you please help me out on this?
  • Verified answer
    WarrenBelz Profile Picture
    156,327 Most Valuable Professional on at
    You are are firstly getting all the Distinct values from 'Events' of the field EventUniqueID, then for each of them filtering the same list with additional criteria and then looking for the matching record. If there is none (as it did not match the bottom filter), you will get a blank result - so maybe do the all the filtering first
    With(
       {
          uniqueID: 
          Distinct(
             Filter(
                'Events',
                Start_Date_and_Time > Now() && Status = "Active" &&
                (Len(RegSearch_2.Text) = 0 || RegSearch_2.Text in Title)
             ),
             EventUniqueID
          )
       },
       Sort(
          ForAll(
             uniqueID As CurrentID,
             LookUp(
                'Events',
                EventUniqueID = CurrentID.Value 
             )
          ),
          Start_Date_and_Time,
          SortOrder.Ascending
       )
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard