cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cbernier12
Resolver II
Resolver II

Only show gallery when match is found in textinput string

Scenario:

One gallery

One textinput field outside of gallery

One collection

 

Is there a method to only show a gallery item if the text in a textbox matches the item in the gallery? So in the Visible property for the gallery, if textinput1.text = item in column in collection matches, then true, otherwise false (don't show the gallery or items).

 

I've tried a number of if formulas and it never likes "=" sign in the formula.

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-yangar-msft
Microsoft
Microsoft

Hi @cbernier12 

 

Could you tell me you want to only show the related item in gallery if the text in a textbox matches the related item in the gallery? Otherwise, the gallery will not show in your screen.

If so, I think you could use other logic operator and identifier in your formula.

Here I use if+exactin and it can meet your requirements:

  1. Add a collection in my app:
v-yangar-msft_0-1610421448334.png

 

      2.Add a Gallery and a TextInput control.

      3.Set the Visible property of Gallery to:

If(TextInput1.Text exactin (Concat(IceCream, Flavor&Quantity)),true,false)

     4.Set the items property of Gallery to:

Filter(IceCream,TextInput1.Text in Flavor||TextInput1.Text in Quantity)

     5.Here is the result in my side:

v-yangar-msft_1-1610421448338.png

 

When I type 40, I can show the record of ‘40’ and ‘Pistachio’ in Gallery, but when I type 400, it will not show gallery directly as below:

v-yangar-msft_2-1610421448340.png

 

 

 

Hope it helps!

 

Thanks,

Arrow

View solution in original post

3 REPLIES 3
v-yangar-msft
Microsoft
Microsoft

Hi @cbernier12 

 

Could you tell me you want to only show the related item in gallery if the text in a textbox matches the related item in the gallery? Otherwise, the gallery will not show in your screen.

If so, I think you could use other logic operator and identifier in your formula.

Here I use if+exactin and it can meet your requirements:

  1. Add a collection in my app:
v-yangar-msft_0-1610421448334.png

 

      2.Add a Gallery and a TextInput control.

      3.Set the Visible property of Gallery to:

If(TextInput1.Text exactin (Concat(IceCream, Flavor&Quantity)),true,false)

     4.Set the items property of Gallery to:

Filter(IceCream,TextInput1.Text in Flavor||TextInput1.Text in Quantity)

     5.Here is the result in my side:

v-yangar-msft_1-1610421448338.png

 

When I type 40, I can show the record of ‘40’ and ‘Pistachio’ in Gallery, but when I type 400, it will not show gallery directly as below:

v-yangar-msft_2-1610421448340.png

 

 

 

Hope it helps!

 

Thanks,

Arrow

View solution in original post

Prakash4691
Solution Supplier
Solution Supplier

Hi @cbernier12 ,

 

You can either use filter or search formula to display list of items in gallery based on conditions.

 

No items will be displayed in gallery, if no match found for entered text input.

 

Reference links,

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-filter-lookup

 

If items in gallery is based on text box search. I'd recommend to use search formula.

 

 

Regards,

Prakash

Thanks @v-yangar-msft that worked perfectly.  Since I only have one field I'm looking for I had to modify the formula a bit:

Gallery properties:
Items: Filter(mycollection,TextInput1.Text in column_in_collection)

Visible: If(TextInput1.Text exactin (mycollection.column_in_collection),true,false)

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,328)