Newbie: Default filter value - how?

Hello there,

I’d like to be able to set a default value for my filters, so that the number of returned results is limited to that selection only. Simply because the initial list with returned results is ~2k, so ideally I’d like to optimize that.

Please advice on what could be the best approach to do so. Thank you!

I’m attaching some references of the current implementation, as well.

FYI - “Виж всички резултати” means “See all results”, which is the current default value which needs to be changed to a concrete one.




Hi!

You can set initial values for the filtering page variables, so they will be set as the default filters when the page is opened. Just set the initial value of the page variable (bottom right corner in my screenshot) as the value of the dropdown option you want to be set as the default filter value.

2 Likes

Thank you so much Cecilia! This worked like a charm : )

Are you able to advise on this scenario, as well? The attached video shows that the moment I open the app >> the initial state is blank with the previously set filter values and then the new “default” criteria is applied directly after it.

Is there an option for me to directly get to the default filter results without having to see the initial state?

I tried using the spinner in the logic flow when the data is being loaded & various other scenarios, though those didn’t work out for me.

Hmm, maybe the initial value setting is not working fast enough in this case… How have you implemented the filtering? I’m guessing you’re at least using data variables, and you could try setting the filtering page variable before the data gets retrieved, maybe that would speed things a bit. Like this:

1 Like

Thanks again! I tried applying the logic as it is, though this time I couldn’t retrieve any data when loading the app. Could I be missing something?

Hmm I think the issue is that now both set page variable nodes go to Get record collection node, so it get triggered now multiple times and that might mess it up :grin: so instead I would put the set page variable nodes after each other, not parallel :slight_smile:

1 Like

Thank you Cecillia! It seems though that the logic flow still does not work : / I tried removing one of the filters, as well so only one is available and still the results are not returned at all if the flow is in place.

Is there something else that can be done here?

Hmm alright! I think one more thing to try is to change the way you are filtering. Currently you are using the visibility property to filter results. There have been some issues with using formulas in the visibility property, so I would suggest instead using the repeat with to filter your results.

So set the visibility of each item back to true, and instead set the repeat with property to a formula. The formula would be the exact same as in your current filtering, just with a SELECT added:

SELECT(data.SheetyList, CONTAINS(LOWERCASE(current.name), LOWERCASE(pageVars.searchText) ... )

Hopefully this will work! :grin:

:grimacing: still not there! I’ve modified the list as a repeat with formula and set the visible status to true

I am not sure whether setting items to current is not the issue here - they seem to be not fully recognized when setting up the results?

I haven’t adjusted the actual filters, just the list - they are set to visible:true - from the start?

I’ve removed the previous logic flow, so now is back to the default one for Page Layout as with it it was till not working.

Still the results I’m getting are just the first value in the filter, which is “See all results”.


ah yes sorry my mistake, the formula can’t be exactly the same because current won’t work in the repeat with property. Replace current with item so it works with SELECT :slight_smile:

Thanks so much for your fast responses!! I missed to confirm in the previous reply that I did try to switch to item, as well, though this returned the same result.

I am not sure whether this is not due to how the repeating items are setup >> they’re set as current?

As this was inherited from the initial list setup >> once the list was set through repeat with & the data variable

We’ll get there! One step at a time :joy:

Hmm everything looks fine :thinking: I think there’s just some small detail off. So you’re not getting any errors in the SELECT(…) formula editor? And the page variables are set as the value of the dropdown option you want as the default?

How is the page behaving now, the correct default filters are set but no data shows up in the list? Does it work if you filter with other dropdown options?

I think there’s just some small detail off.

Yes! Hopefully :crossed_fingers:

Yes, no errors in the formula for the repeated with list.

The results I get are as before >> I get no results & the filters are empty, as well = just the “See all results” value is there. The filters use item. for the value, though this was working well before (when the list was set through a formula under visible


Weird, seems like there’s something wrong with your dropdowns as well, if they’re. not showing any other options even though you used the CONCAT(...) formula for them… If you want I can go and take a look if you provide me with your app id :slight_smile: it’s the number sequence found in the url of your app.

Thank you, that would be amazing :pray: This should be the app id 199829!

Hi! I took a look and it seems like there’s something wrong with the SheetyList data fetch, I’m getting the error code 402 in its fetch. This would explain why no results are shown and the dropdown list is not getting the correct options. Are there any fetch limits in your REST API that you might have exceeded, or any payment walls for it? My guess is on exceeding a fetch limit, since you were able to get it working before.

Otherwise the app looks like there’s nothing wrong, I think your issues will be solved when the REST API gets sorted out :slight_smile:

1 Like

OMG… and I had the same issue once again before… thank you Cecilia! this slipped through my mind, now the limit is again restored : ) With the new way of setting up the list, it loads faster!

My final question will be is there a way for me to put a spinner right before the list shows as we still have a 1-2 second delay before the results show up? Thanks so much!

Sure! I would use a page variable loading which is true/false with the initial value false. Then in the logic canvas for your data set loading to true when you start your data fetch, and switch it back to false when it’s done. This way you can add a spinner component to your page and bind its visible property (under advanced properties) to the variable loading and set the your data list’s visible property to NOT(loading).

2 Likes

Thank you, Cecilia :muscle:

The spinner looks great!

Edit: One thing to note, maybe a bug - on iOS & Web the flow works great, just when you open the app on Android >> you get an infinite loading state and the results are never retrieved. The filters are empty, as well - just the “See all results” value is displayed : /

Wow that’s odd! Are you able to check the debugger if the data is getting retrieved correctly on Android? Or set some alerts in those Get record collection node outputs to see if it succeeds or fails :thinking: and does this happen only when the app is first opened or does the data never get retrieved?