How to Filter Query with "Array Contains" or "Array Contains Any"?

Actions & Logic
Resolved

I have a collection of job highlights that have been categorised based on their industry sector, industry or if they are related to all industries. I want to have them displayed in a choice chip widget for the user to then select which ones are relevant to their job ad. I only want to display those relevant to the industry sector the job ad is for and therefore I need to do a query filter. I am having trouble figuring out how to do the query with the filter "array contains" option as either, I cannot select the appropriate field (it does not allow me to select a single string field, only those that are lists) or when I change the field to a list of strings, I am unable to save the filter and it tells me the "current variable is not valid." I'm stumped on how to make it work and Flutterflow's documentation inadequately explains the logic behind these types of queries. What am I missing?

For reference, is is the "available options" section of the query filter that is causing the issues. I am using Firestore for the database.

UPDATE: I made the decision to move my backend to Supabase and this solved my issues around complex handling of my data.

What have you tried so far?
  • I have successfully filtered my data based on the boolean value (all_industries), so this is not the issue.

  • I have tried to do both "array contains" and "array contains any" with no success.

  • I have tried changing my relating value to a list of strings (even though it never will be a list) and the filter will allow me to select that value, but it won't let me save it.

  • I have tried to filter the data both in the initial query and in the Define Options section of the Properties tab.

  • I have ensured that the data I am comparing is not empty.

Did you check FlutterFlow's Documentation for this topic?
Yes
4
3 replies