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 / Strange issue with Gal...
Power Apps
Answered

Strange issue with Gallery when using Search()

(0) ShareShare
ReportReport
Posted on by 15

I'm encountering a strange bug when using Search on an SQL View. 

I have a TextInput (the searchbar) and a Gallery displaying items from a SQL View. When there is text in the searchbar, the Search() functions works as expected and the Gallery items are filtered.

However, a strange issue occurs when I clear the searchbar. Please see the spoiler below:

Spoiler (Highlight to read)
PowerApps Search Bug

Here's the code for Items in the Gallery:

Sort(
 Filter(
 If(Len(TInSearch_Request.Text) > 0, Search('[dbo].[VW_PendingItems]', TInSearch_Request.Text, "Title"), '[dbo].[VW_PendingItems]'),
 && Approver = User().Email
 ),
 CreatedDateTime, Descending
)

Am I doing something wrong here? 

Categories:
I have the same question (0)
  • dinusc Profile Picture
    Microsoft Employee on at

    Hello @TCheong,

    Could you please describe what the issue is? It is not clear from the attached animated image.

    Thank you.

  • TCheong Profile Picture
    15 on at

    Hi @dinusc,
    The app works as expected up until I clear the searchbar. Take note of the first item in the gallery. After clearing the searchbar, the Gallery should show the original unfiltered list of items. However, the first item in the list seems to have turned into a duplicate of the second item.

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Hi @TCheong

    Sort(
     Filter(
     If(Len(TInSearch_Request.Text) > 0, Search('[dbo].[VW_PendingItems]', TInSearch_Request.Text, "Title"), '[dbo].[VW_PendingItems]'),
     && Approver = User().Email
     ),
     CreatedDateTime, Descending
    )

    When I pasted your formula into PowerApps, I could see that it was struggling to see where your conditional check ended within the Filter argument:
    image.png

     

    Could you try removing the && from the formula (as it is implied by being the part of the Filter function that is tested against)?

     

    Cheers,

    @iAm_ManCat

  • TCheong Profile Picture
    15 on at

    Hi @iAm_ManCat, thanks for pointing that out.

    I had removed some filter formulas in my original post for simplicity's sake, and forgot to remove the &&. I'm using the correct syntax in the actual code though.

    I tried using just 'Approver = User().Email' as the only filter formula. Unfortunately, the same issue still occurs.

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Ok, thanks for clarifying 🙂

     

    I recreated your code for the Items section exactly using my data and didn't run into the same issue, when I clear using backspace while still in the bar it shows the exact correct items, no duplicates, so I'm not sure what the issue may be.

     

    Sorry I couldn't help any further!

     

    image.png

  • Verified answer
    TCheong Profile Picture
    15 on at

    @iAm_ManCat, thanks for your time.

    I've done some testing of my own, and this issue seems to only happen with SQL Server Views. It does not occur with other datasources (e.g. regular SQL Server tables, collections, etc.) as far as I know.

    Also, I've found that refreshing the SQL Server View datasource (i.e. Refresh("[dbo].[VW_PendingItems]") after clearing the searchbar returns the Gallery Items to its original correct state. As a workaround for now, I'll manually refresh the datasource every time the searchbar is empty.

    I do hope this issue gets fixed though, it's preventing me from achieving the responsiveness that I want for the app.

     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 387

#2
timl Profile Picture

timl 340 Super User 2026 Season 1

#3
Vish WR Profile Picture

Vish WR 301

Last 30 days Overall leaderboard