cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
caitlink
Helper I
Helper I

Showing gallery items on app start

This is probably a silly question, but how can I have my gallery display its list of items when the app starts? Previously it was doing so, but when I changed the Filter on my gallery items to use in rather than StartsWith, it stopped showing the gallery items when it started. Now a query has to be typed and then cleared for all the items to show. This is the Filter I'm using to allow users to search by name, practice, expertise, or sector: 

 

Filter(Directory,StartsWith(FirstName,searchQuery) || searchQuery in Practice || searchQuery in Expertise || searchQuery in Sector || StartsWith(LastName,searchQuery))

 

Thank you for any help!

1 ACCEPTED SOLUTION

Accepted Solutions

@caitlink 

 

Search(Filter(Directory,StartsWith(LastName,searchQuery) || StartsWith(FirstName,searchQuery)),searchQuery,Practice,Sector,Expertise)

 

Does it work with Search outside instead?

View solution in original post

8 REPLIES 8

@caitlink 

 

In case you are using SharePoint:

in is not delegable on SharePoint and it could result in returning results cut off - less results than expected - if the total record count is greater than the delegable limit (default 500 - max 2000).

 

Instead recommend to use "Search" instead of "Filter" for the non-exact match stuff. Then use Filter and StartsWith like you do now for any you keep with StartsWith or any exact match ones.

 

If using Dataverse and setting 

poweractivate_0-1634734377998.png

 

then it's fine, and if that is case I could not reproduce this error. 

Check your app for anything that is modifying the search query or gallery items.

 

If you change it back now all of them to StartsWith and save right now, does the issue persist or does it go away again? Just curious of it. 

 

Also are you trying this on the Edit mode or Preview mode as opposed to publishing and trying on real app? Note that sometimes if you have anything in App OnStart, there may be difference when testing it in Editor or preview mode. You may need to click on App node and click ellipses, then click on "Run OnStart". Note also there are possibly some very recent changes to this feature such as App.StartScreen - this may also be a factor and if it is, you may need to make sure to Navigate to StartScreen from App Node to check it correctly from Editor - then also check if the App is set to App.OnStart or if it is set to App.StartScreen and use the right way to run it accordingly if wanting to see initialization properly off the Editor directly (including possibly the Preview of the Editor too) and not the Live app every time. If it really only is consistent for you when publishing and running the app directly, then only do that for the moment. If this is hard to keep track of and giving you trouble, move everything from OnStart and StartScreen (if any is applicable) to OnVisible of the First Screen (at least temporarily if you can't do it for good), then toggle back and forth between screens to quickly reset everything in the Editor (or use Preview and everything will init off the first screen each time without worrying about OnStart or StartScreen).

 

 

Thank you! I am using Sharepoint. The list only has a few items on it right now. I saw the behaviour both on the app when previewing it, and after publishing it and running it. 

 

I'm not sure how to use Filter and Search at the same time (yes, I'm very new to this!). Do you have an example I could try?

 

Thank you1

@caitlink 

 

You basically chain them like this:

 

Starting from this:

Filter(Directory,StartsWith(FirstName,searchQuery) || searchQuery in Practice || searchQuery in Expertise || searchQuery in Sector || StartsWith(LastName,searchQuery))

 

Take all the inner ones and keep replacing the Data Source "Directory" with the equivalent stuff in each clause.

 

I also did some other stuff such as combining - with Search you can specify more than one Column to Search for example.

 

Then I get:

 

 

Filter(Search(Directory,searchQuery,Practice,Sector,Expertise),StartsWith(LastName,searchQuery) || StartsWith(FirstName,searchQuery))

 

Check if something like above helps @caitlink 

caitlink
Helper I
Helper I

Thank you so much for your help! There's nothing in app OnStart. Unfortunately, the Search within the Filter doesn't work - it causes the same non-loading of the gallery, and the search itself doesn't work. The simple search does work in that the gallery loads and it searches the columns correctly: Search(Directory,searchQuery,"Expertise","Practice","Sector")

I'm thinking maybe the Filter function is causing the gallery to not display?

@caitlink 

 

Search(Filter(Directory,StartsWith(LastName,searchQuery) || StartsWith(FirstName,searchQuery)),searchQuery,Practice,Sector,Expertise)

 

Does it work with Search outside instead?

caitlink
Helper I
Helper I

It's working with Search on the outside, thank you! The preview doesn't work, but it does seem to work when the app is run. Thank you so much for your help!!

caitlink
Helper I
Helper I

Sorry, no, it isn't working after all. The search is working again (it doesn't work in preview, but does in the live version). But the gallery still doesn't show up on load.

@caitlink Some changes were made to the App.OnStart feature recently.

Check here and see if it might be affecting you. Especially try suggestion from @Mostafa mentioned in there somewhere:

Navigation in App.OnStart not allowed anymore (New App.StartScreen??) - Deep Link problem 

It might not be related to your issue but in case it happens to be please check it.

 

If the above is not it, then...

 


@caitlink wrote:

...a query has to be typed and then cleared for all the items to show....


So it looks like the main issue you really have is that nothing shows up when the Text Input is blank for the first time.

I think this happens because you need to handle the specific case of the Text Input being completely empty to begin with, which might be a very specific thing that only happens when the TextInput first exists and nothing has been typed in yet. See this post for example:

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

You can try something like:

 

Items property of Gallery:

 

 

If(IsBlank(TextInput1.Text),DataSource,Filter(DataSource...))

 

 

 

 

Basically if it's blank, don't even try to Filter or Search or anything on it at all and use the naked data source itself in Items, or if you have to filter or sort or anything like that put as few Filter or SortByColumns formulas as possible and make them as simple as possible and make it not use anything from the Text Input at that branch of the If condition, or something like that.

 

See if the above ideas help @caitlink 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,149)