How to dynamically filter on-device storage?

I’m having trouble making a dynamic filter on On-device storage.
I have a dropdown with 39 items, each item has 4 filter inputs, so it’s 39x4 totaling 156 filters. I made a formula with all the filters, it had 664 lines and it took almost 50 minutes to paste the formula in appgyver (an error message appeared but in the end I managed to paste the formula) but then it was very slow to use the app.

Because of these problems, I’m trying to create a dynamic filter that, when the inputs are filled, I build the formula

I created a text variable to store the formula, but it is incompatible with Filter condition.

Which variable is supported?
On the Filter condition screen it says that it is an object with 2 properties, I made a test object with 2 properties but it is incompatible.

Can someone help me?

Hi, anyone from support to help?
I need to know how to create a variable to use in the On-Device Storage Filter Condition.
It is possible?
What is the structure of the variable?

Try clicking on the “object with properties” option in the formula binding screen. There you will see what kind of object is the filter object. It is easier to set the filtering from that screen than trying to figure out what is the exact schema of the object with two properties.

If these filters don’t fit your needs then we could and should be figuring that out as well.

Thanks for the reply, but I already did that.
I need the filter to be dynamic, because I have 154 filters (see the explanation at the beginning) and when I loaded all of them the app was very slow and crashed, it took 50 minutes just to paste the formula in the filter condition.
So I need to know how is the variable to mount.

Then do it with one object save, and close the modal. Then click on the same filter and set the type of it to the formula, it will reveal the structure of a filter query. Something like this:

{type: "and", conditions: [{type: "equal", property: ["client_id"], value: "hello"}]}

In this you’ll have to change your “client_id” to any property that you have and the value to the appropriate value.

Also, some other things to note here.
The conditions property is an array, so you might want to use a MAP() formula to go through your list of filters.
Hope this helps more.

Or to even take it further:

{type: "or", conditions: [{type: "equal", property: ["client_id"], value: "hello"}, {type: "equal", property: ["uuid"], value: "fadhsjkfhasl"}]}

This is how you have multiple filters. If you need to match all conditions, you’d need to set the “type” to “and”.

Sorry, I don’t think I could explain it well, I’m using the translator to explain in English.
I made the formula, but it is too big, see the file below

Formula Filter Condition

In the video below, I show that I’m setting up the dynamic formula according to the chosen inputs. That’s why I need to use the variable in the filter condition.

Oh-oh… I feel like there is something really off here. You basically hard-defined all the conditions that are not even finding the right properties in the local data resource…

What is the end goal here? What are you trying to achieve with all these filters?
Maybe I can suggest a different approach because this is no doubt will cause a lot of trouble for you very soon.

From the video I feel like you’d need something like:
WITH_ITEM() formula which would add each new condition based on the dropdown value.

What language do you speak? If Spanish, then maybe @Diagonal_Movil can help here.

Thank you for the tip.
I will try WITH_ITEM()

I speak brazilian portuguese


I found out how the structure of the filter variable is.
I used the WITH_ITEM function along with it
Below is the structure of the variable for those who want to try it

Hello Mihaly,

I’m using a search bar to filter my on-device storage displayed on a table. Since the default value of the search bar is empty, my table is always empty. Is there a way around this issue? No property offers “ignore”

How do you “repeat” your table? Is it a different variable that is created when the search bar value changes?

I would suggest looking up this formula to be used in the “repeat with” property.

SELECT(list, selectionFormula)

For your use case. Let’s say you want to search a data.list and filter by a property title with a search value pageVars.mySearch I would do a formula like this:

IF(IS_EMPTY(pageVars.mySearch), data.list, SELECT(data.list, CONTAINS(LOWERCASE(item.title), LOWERCASE(pageVars.mySearch))))

What does this do?
Checks if the search value is empty. If it is empty, then it shows the regular list without a search. If the search is not empty it selects only those items from your list which contain the search term. The LOWERCASE() formula ensures that it doesn’t matter what case a user types in the search bar…
The above formula can be extended to multiple conditions. Just add them with || symbol after the CONTAINS() formula.

1 Like

Yes this totally works, but in my case unfortunately I’m using a basic table component that I found on the marketplace and it doesn’t have a formula box only the filter conditions. as you’ve posted in the above {type: “and”, conditions: [{type: “equal”, property: [“client_id”], value: “hello”}]}. Thanks anyway I’ll find a new table or way to display my data !