Filtered list: show if attribute is in list OR is empty

Hi all,

I have a repeating group showing a filtered list of things (CatalogoSettimane’s ProdottiDaProdurre:filtered)

One of the filter conditions is done on the attribute TipoProdotto is in npd’s lista-prodotti (which is a list). this is the current behaviour.

I want the filter to show the product if TipoProdotto is in npd’s lista-prodotti OR if TipoProdotto is empty.

how can I achieve this?
I would like to keep the number of searches as low as possible for performance reasons.

1 Like

You can use “advanced” with filtering but you can also merge two list but with different filters and use :unique item at the end

thank you,
this is what I did not want to do because I would need to run two searches and this slows down performance significantly because this element is repeated tens of times in my page.

I need to look into the advanced system you mentioned, I have no experience with this, can you provide a practical example?

thinking this through, a possible solution would be to add an empty thing to the list “npd’s lista-prodotti”.

but I don’t know how to do it. Is it possible at all?

I’ve used the solution you suggest, and it works just fine. Adds a little extra work and upkeep to your development, but it’s a lot quicker than :advanced or merged results.

Maybe you can solve it with conditions too though. If it’s only that one field you have circled it’s probably the easiest solution (change the data source if a given list is empty for example).

thanks! care to explain how? I can’t seem to figure it out on my own.

Sorry, I was too quick to reply to this, I didn’t realize you were using a filter and not a search. In this case, conditions won’t solve it. The way you suggested is probably the quicker one here, but it will be a bit cumbersome setting it up and maintaining it.

Have you tested if combined searches can deliver an ok load speed though?

I used to be very sensitive to list loading speeds, but having spent hundreds of hours and made fairly simple projects very complex simply to avoid a few searches has made me revise that attitude a bit. I’ve come to appreciate the flexibility of “non-hacked” lists more than the small amount of time it shaves off during loading.

Not to question your concern here, just thought I’d bring it up that my personal obsession with speed has sometimes pushed app development in some really unnecessary complex directions.

1 Like