[Resolved] Filtering collection: binding var doesn't work but same number works

I have a collection that contain parameter as array with Image IDs. I want to display that collection filtered - if image ID is in array then item should be displayed.

Something strange: when I link variable “image ID” - it doesn’t work! When I just type ID as number - it works.

I cannot figure out how can I fix that. Any suggestions what that problem could be?

example: i filter collection where ID = 2 and it works

here formula is binded variable which is also 2 - but no result

Try wrapping the id in toNumber() and see if that works. Or, vice versa … is that data in the array an integer? or is it being treated as a string?

1 Like

Thanks for the answer, this var is integer. I take this value from object and use elsewhere and it works for other cased. Just such kind of Filtering doesn’t work somehow ( for other variables as well, i try other var as ID (integer) and number works but not bound ID …)

Solution found with just experimenting.

My array “has any of” [id]

Ive used not CONTAIN but HAS ANY OF and made array of my ID [2]. I dont see logic in this but it works :grin:

Ah, yes. I believe the Contains is used for a string. The Has Any is used for arrays.

1 Like