cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Gallery Items do not show up until something is typed in text search box

When I log into my app, the gallery is blank.  After typing something in the search box, the items appear and will stay visible even if I delete the text from the search box.  In the 'Items' section of my gallery, I have:    Search(SortByColumns(Entity, "Username", If(SortDescending1, Descending, Ascending)),TextSearchBox1.Text, "Username")

The gallery will display correctly if I only put 'Entity' in the Items section, but then the search box would have no functionality.  How do I make the gallery display automatically when I log into the app while still keeping functionality for my search box?

 

 

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks,

Reference:https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/

Hey please keep in mind the concept is the IF statement, we still need to get the details right for everything else.

Also, we can try different syntax found in the above.

 

Some observations from the code below:

  1. You can't include the searchinput.text on the first if statemement because we want this to be the default criteria if the textinput is empty. To give this a proper default filter withou input from the TextInput control you may need to change the Search() function to possibly a Filter() function and settle on what a default filter looks llike. Example below.
    1. If(IsBlank(TextInput.Text),SortByColumns(Filter(Entity, Column=true,Column=false),"Column", If(SortDescending1, Descending, Ascending)),SortByColumns(Search(Entity, TextSearchBox1.Text, "Username"),"Column", If(SortDescending1, Descending, Ascending)))

I trust you understand the concept, 

If textinput is empty, ignore textinput and Fliter like this. If it is populated, Search using the textinput like this.

 

View solution in original post

3 REPLIES 3
nickduxfield
Responsive Resident
Responsive Resident

You could possible use an If statement to get you going, then you can use other more complex methods later.

Think of your default filter for the gallery without the textinput, then setup an if IsBlank.

If(IsBlank(TextInput.Text),SortByColumns(Search(Entity, TextSearchBox1.Text, "Username"),"Column", If(SortDescending1, Descending, Ascending)),SortByColumns(Search(Entity, TextSearchBox1.Text, "Username"),"Column", If(SortDescending1, Descending, Ascending)))
Anonymous
Not applicable

Hi @nickduxfield,

 

I tried out your suggestion but am still having the same issue of not being able to see gallery items until after I type something into the search box.

Gallery issue.PNG

Thanks,

Reference:https://powerapps.microsoft.com/en-us/tutorials/function-filter-lookup/

Hey please keep in mind the concept is the IF statement, we still need to get the details right for everything else.

Also, we can try different syntax found in the above.

 

Some observations from the code below:

  1. You can't include the searchinput.text on the first if statemement because we want this to be the default criteria if the textinput is empty. To give this a proper default filter withou input from the TextInput control you may need to change the Search() function to possibly a Filter() function and settle on what a default filter looks llike. Example below.
    1. If(IsBlank(TextInput.Text),SortByColumns(Filter(Entity, Column=true,Column=false),"Column", If(SortDescending1, Descending, Ascending)),SortByColumns(Search(Entity, TextSearchBox1.Text, "Username"),"Column", If(SortDescending1, Descending, Ascending)))

I trust you understand the concept, 

If textinput is empty, ignore textinput and Fliter like this. If it is populated, Search using the textinput like this.

 

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (1,088)