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

**URL:** <https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637>\
**Category:** Ask us anything\
**Created:** [December 26, 2022, 2:00pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637 "2022-12-26T14:00:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anna.fae](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/anna.fae/32/776_2.png) [@Anna.fae](https://community.weweb.io/u/Anna.fae)\
**Post date:** [December 26, 2022, 2:00pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637/1 "2022-12-26T14:00:22Z")

</div>

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

 ![Screenshot 2022-12-26 at 08.49.24](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/615964f4d9222fad724f9a3fac0ce11ab90f03f1.png)

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

 ![Screenshot 2022-12-26 at 08.49.07](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/694bd7be9d5b070cc1a684e186e3175bd4070847.jpeg)

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [December 26, 2022, 6:33pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637/2 "2022-12-26T18:33:46Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Anna.fae](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/anna.fae/32/776_2.png) [@Anna.fae](https://community.weweb.io/u/Anna.fae)\
**Post date:** [December 26, 2022, 10:17pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637/3 "2022-12-26T22:17:41Z")

</div>

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 …)

---

<div class="post-metadata">

**Author:** ![Anna.fae](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/anna.fae/32/776_2.png) [@Anna.fae](https://community.weweb.io/u/Anna.fae)\
**Post date:** [December 26, 2022, 10:23pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637/4 "2022-12-26T22:23:55Z")

</div>

Solution found with just experimenting.

My array **“has any of”** [id]

 ![Screenshot 2022-12-26 at 17.21.59](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/6/6d307aaf3ac96ffefbe22d02f51968c9b89fa063.png)

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

---

<div class="post-metadata">

**Author:** ![kevinwasie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/kevinwasie/32/402_2.png) [@kevinwasie](https://community.weweb.io/u/kevinwasie)\
**Post date:** [December 26, 2022, 10:40pm UTC](https://community.weweb.io/t/resolved-filtering-collection-binding-var-doesnt-work-but-same-number-works/1637/5 "2022-12-26T22:40:22Z")

</div>

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