Compare two file propertiy-lists

I am trying to create a filter that compares two String list file-properties as such:
active file-property list: value1, value 2…
second file-property list: value x, value y…

i want the filter to show the second file if there are matches and partial matches. So if value 1 == value x OR value 1.contains(value x )

So basicly the dataview any(contains(list1,this.list2))

I tried .filter, two “OR” filters where i switch which value is compacted to a string. But i cant seem to figure it out.

If the answer is easy, i am sorry :stuck_out_tongue_winking_eye:

Maybe something like this could give you a lead to follow :woman_shrugging:

list1.filter(value == this.list2[index] || value.contains(this.list2[Index]))

index here is the index of the values in list1 so it compares each value in list1 to the items in list2 at the same index (not sure if that’s very clear :sweat_smile: )

This is if the index of the values in each list is important and it could still require some tweaking though, depending on your needs :blush:

If the index isn’t really important though, I guess this could potentially be enough :woman_shrugging:

list1.containsAny(this.list2)
1 Like

Sadly the easy Option was already tried - more hours ago then i will admit :wink:
It doesnt seem to check for substrings in both directions.

But the index one could work for my usecase. Thanks very much for the input. I am gonna tinker around some more with this :wink:

1 Like
// whole matches
list1.filter(this.list2.containsAny(value))

// partial string match
list1.filter(this.list2.toString().containsAny(value))

And the other way around:

// whole values
this.list2.filter(list1.containsAny(value))

// partial values
this.list2.filter(list1.toString().containsAny(value))

One of those pairs should do it, unless I misunderstood.

I wrote them in both directions because I’m unsure from your description which way you’re going. Your Dataview example showed a direction that I interpreted as opposite from the description, because I would call this the “active file”, but your description seems to call the queried file the “active file”. Having both pairs hopefully keeps any misinterpretation I had from getting in the way.