List(List('A', 'B'), List(1, 2)).Contains(List(1, 2))
returns false, I would expect it to return true
How can I do a similar comparison searching for matching sublists of lists?
List(List('A', 'B'), List(1, 2)).Contains(List(1, 2))
returns false, I would expect it to return true
How can I do a similar comparison searching for matching sublists of lists?
I would expect the same…
I suspect that the comparison is made on the flattened list of values, as
ListCombine(List('A', 'B'), List(1, 2)).Contains(List(1, 2))
does work.
Is this a viable workaround for you?
I think I responded to this a while ago but cannot find the thread.
The thing is, if you write .Contains(List(1, 2))
, it unwraps the list in the brackets and tries to match whether your list of lists contains values 1
or 2
on themselves. I think the behavior is like that so that people matching on ListOfValues.Contains(Table.Column)
would work as expected: unwrap the list of values from the column and try to match on items individually.
The workaround is to wrap in yet another list:
List(
List(1, 2),
List(3, 4)
).Contains(List(List(1, 2)))
Ah right! You did give me that same answer previously. Hard to remember to do that. Would be nice if there were a ContainsList
formula that implicitly wrapped the sublist