Filter collection by: json object - contains - array?

Hello,

Im currently working with a collection which i need to filter by a product_id’s (use case - to show users favourited items).

I have a colletion from API call where the “product_id” is under the json object named “source” (as seen in the screenshot below) but when im trying to filter the collection it only let me choose “source” as whole - nothing else/underneath it. So right now im trying to filter the json object named “source” of the collection by checking if it contains an array of “product_id” but so far i had zero luck doing so.

May i ask what would be a proper way of achieving this?
Any kind of advice is welcomed:)!


Hello, still wondering if this is might be doable somehow?:slight_smile:

Hello, it’s currently not possible, you could do this inside a formula and bind result of that formula instead of the apify data

Thank you for your reponse!

Do you think you could elaborate little on the “formula” - how could that specific formula look like?

You would need to go to Actions → Formulas → Create
Then you would do some logic to filter an array based on your choosen conditions, and use that formula to “filter” your collection.

1 Like

I see the Data type are different (text and integer)… Try use toNumber() formula to set the ID text to number, or toText() to set the ID integer to text…

1 Like

Thank you so much, both of you, by combining these two tips i have kinda make it work! Appreciate it.

1 Like

Hi @Robyn, would it be possible to share how you built it?

Thank you!