Filter data by ANY condition (need some help)

So having looked into some other similar questions, maybe im so bad but i cant get it to work.
More specifically, i want to filter a data collection (from Firestore) based on a documents fields input of ids. The ids are stored in comma separated format like this ( , 3NhYX0s4QOOgj5hXUv71vGNzgTS2, 5P9v0PxBADMLvZFqDIfZGy0iR3f1, rxfZpf4E0KVQ1FXLvsFnMXignM7 ).
In general, i think it should work like this:
get the id document, next input this in the filter condition and then ask only for the documents whose id is contained in the comma separated list of ids.

I really appreciate a lot if you get give me some help as im really stuck on this problem.
tell me what you think and ask me for more details if needed.
This is how the list of ids is stored.

And this is the collection to be filtered

Hi, this should do the trick: SELECT(<collection to filter here>, IS_IN_ARRAY(SPLIT(<ids string here>,", "),

→ Select all items from the collection whose id is found in a list that is formed by splitting the ID’s string at each occurrence of ", "

First of all thank you so much for the quick response,
This is the error it gives me in the filtering formula

For more details, this part STRING(LOOKUP(data.newfollow1.fields.ids, “stringValue”))
gives this as an outcome

can you find any mistakes ?

Hi, sorry I seem to have misunderstood the question – if you want to do the filtering server-side, it depends on what backend you are using. If you click on “Object” instead of Formula in “Filter condition”, it gives you a view where you can configure the condition, but it’s unfortunately not dynamic.

1 Like

Hey im using firebase as the backend, but you mean that in order to make server side filtering from firebase, you can only use the Object with properties conditions? and dynamic filtering (using formulas) is not possible?

@Dimos_Vamvourellis I think there is a way – this is a very new functionality so there is no tutorial yet, but if I put in this condition:

And then switch to formula it evaluates to:

{type: "or", conditions: [{type: "equal", property: ["id"], value: "abc"}, {type: "equal", property: ["id"], value: "def"}]}

So if you generate a similar “conditions” list with MAP and your IDs it should work:

{type: "or", conditions: MAP(<your list of ids here in format [{id: "abc"}, {id: "def"}, ...]>, {type: "equal", property: ["id”], value:})}

woo now this looks so promising, i will work on it.
Thank you very much!!
I will probably get back to you soon.

So if you take a look this might be a bug, When using condition for any id, the result is this (tested it many times with different ids)


Also, even though with other variables like name it works fine when using one but if you use more than one, the raw response from get collection logic is this


If anyone else identifies the same problem or finds something i do wrong, please let me know!

Hi @Dimos_Vamvourellis, indeed looks like there are bugs with the id filtering and ANY condition with Firebase. I’ve reported it to the development team, thanks for pointing these out!

Thank you very much @Mari i will stay tuned for the solution.
One more thing to take a look, is that when you use filtering and ordering together it returns a 400 error but when using them separately they work fine.
I think you should mention this too.

1 Like

Hey @Dimos_Vamvourellis, more info:

The first issue is a Firebase limitation – Firestore doesn’t have an id field we could use to filter the documents. It has a name property that contains the path to the document combined with the “id”, which is not a queryable document field like the other data fields.

The other issue is also related to how Firebase works, it requires you to set up indices manually for all fields you want to query. If you open up the Network tab in Chrome developer tools while in the web preview (right click on browser window → “Inspect”), you’ll be able to see the actual error message which is “The query requires an index” and a link to where you can create the index.

More info about the limitations here:

Hey @Mari even though i still get the same error message, i cant find the link i need to follow from firebase, could you help me?

Switch from Console to Network tab, the Firebase error should be there. :slight_smile:

Hey, really dont know if im doing something wrong, but i cant find the firebase link anywhere…
has anyone got more luck?

indeed after looking more closely i cant find the link anywhere. Do you know whats going on?
Thank you in advance

Hi there, If I am not mistaken what is @Mari trying to say is to open Developer Tab, select “Network” and then look for “event.json” (usually, but could be different).

Alternative is to try to call the same via the Postman. Usually Postman will tell you more than Appgyver do and to be honest, sometimes is better to use direct API calls as AppGyver is not 100% compatible with Firestore (for example, Firestore requires PATCH for update and Appgyver’s doing POST via Update Record) and there’s much more cases. So get yourself Postman, look for the endpoint you need and try it.

Ref: REST API базы данных Firebase
Ref: Cloud Firestore API  |  Firebase

Hi there, thanks for the response, this is what i get in the response,

even though as an error from firebase i get the Failed to map firestore query conditions.
i dont know why that error is not showing in the respone.
do you think i should look in postman?

Hi @Mari im sorry for tagging you, but unfortunately i haven’t still resolved my problem and i have looked everywhere for help. If you have any more knowledge on what’s going on, i would appreciate your help a lot.
So the problem, still remains that i cant find the firebase link to create the query filtering, even though i get the error message about mapping query conditions.

Hi @Dimos_Vamvourellis, sorry for the long follow-up time! What kind of query exactly is it that is giving you this error, is it the one with an ANY condition? Looks like Firebase has a limitation there:

Cloud Firestore provides limited support for logical OR queries. The in , and array-contains-any operators support a logical OR of up to 10 equality ( == ) or array-contains conditions on a single field. For other cases, create a separate query for each OR condition and merge the query results in your app.