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 bar cau...
Power Apps
Answered

Gallery search bar causing unexpected effects

(0) ShareShare
ReportReport
Posted on by 117

Hello,

I am creating a work order app with an item grid displaying every item available to order. Within the grid are 3 text input boxes (quantity, price, ounce size) and a button to clear the fields. There is a search bar above the gallery that filters the gallery by stock number or description. 

Here is my gallery's items code:

 

 

 

SortByColumns(
 Filter(Order, ItemSearch.Text in Description || ItemSearch.Text in Text(Title)), "Title")

 

 

 

 

I'm having 2 problems with this setup that I'm hoping someone can help me with. 

 

 

1. I have the clear fields button set to only be visible if the quantity text box is not blank. I have this in my "Visible" property:

 

 

 

If(!IsBlank(Quantity), true, false)

 

 

 

This works perfectly fine when I first open the app. But when I type anything into the search bar the button appears on every item. I also have a TemplateFill property of the gallery with If(!IsBlank(Quantity), LightGreen, Transparent), and that is also behaving in the same way as the button. 

 

 

2. This one is the much bigger problem. If I have entered vales into any input box, and then use the search to find a new item, the fields that I entered previously are cleared out. 

 

Any thoughts?

 

 

UPDATE:

I also tried changing the Items property of the gallery to use a search function instead of filter, I started with just searching by description to test it:

Search(Order, ItemSearch.Text, "Description")

This is behaving the exact same way as before. 

Categories:
I have the same question (0)
  • eka24 Profile Picture
    20,925 on at

    Is quantity a name of a Textbox or a column. 

    Try

    If(!IsBlank(QuantityTextbox), true, false)

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • BillKern Profile Picture
    117 on at

    It is the name of the text input box. I'm getting an error saying "Name isn't valid. This identifier isn't recognized" when I try QuantityTextbox

  • eka24 Profile Picture
    20,925 on at

    Please click on the Textbox you have named as Quantity and take a screenshot.

    You are to replace the QuantityTextbox with that name. If you are not sure just Post the screenshot

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • Al_10 Profile Picture
    1,691 Super User 2024 Season 1 on at

    if you use text input and Quantity is the name of that control:
    If(!IsBlank(Quantity.Text), true, false)

  • BillKern Profile Picture
    117 on at

    BillKern_0-1596554696054.png

    Here's a screenshot. The gallery starts off white with no X's, If I search for an item (in this case #7007) and enter a quantity, then I clear the search terms, the whole grid turns green and shows X's at every item. 

  • BillKern Profile Picture
    117 on at

    @Alex_10 That did it, I was missing the .Text. Thank you!

     

    Never mind, when I search an item, add a quantity, and then clear the search all items are still green with X's

  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @BillKern :

    Q1:Never mind, when I search an item, add a quantity, and then clear the search all items are still green with X's

    The key is that the control has a default value.

    Solution1:

    Please set the Quantity's "Visible" property to:

     

    Quantity.Text<>"Quantity"

     

    Solution2:

    1\Clear the Default property of the Quantity

    2\Set the Quantity's "Visible" property to:

     

    !IsBlank(Quantity.Text)

     

    Q2: If I have entered vales into any input box, and then use the search to find a new item, the fields that I entered previously are cleared out.

    Do you want users to clear the search box after the first search, and then search on the first search results when searching with new keywords?

    I did not understand what you mean, could you explain it in detail?

    Best Regards,

    Bof

     

  • Verified answer
    BillKern Profile Picture
    117 on at

    @v-bofeng-msft Good morning! 

     

    I actually solved both of my problems with one solution. 

     

    Users are able to enter values into the input boxes in the gallery, then once they click on the search bar I have the OnSelect property set to patch that data to the collection. 

    ForAll(
     ItemGrid.AllItems,
     If(
     Value(Quantity.Text) > 0,
     Patch(
     Order,
     LookUp(
     Order,
     Value(StockNbr.Text) = Value(Title)
     ),
     {
     OrdQty: Value(Quantity.Text),
     OrdPrice: Value(Price.Text),
     OrdOz: Value(Oz.Text),
     Updated: true,
     OnHand: Value(QtyAvail.Text)
     }
     )
     )
    );

     

    This solved problem 1, because the default property for the input boxes displays the text inputted or if the collection is >0 it displays what is in the collection. So when the gallery is filtered the data isn't erased.

     

    The Visible property for the X was kept as 

    If(Value(Quantity.Text) > 0, true, false)

    But for some reason after the items are patched it works as I intended. 

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard