Forum Discussion
"Does Not Contain" is picking up null values
Thanks BA_Pete . The logic doesn't really make sense to me, but it fixed the problem.
You're giving the the SelectRows function a choice: either give me something that doesn't contain "Duplicate", or give me a null.
However, this is a very narrow example-case, so the logic may fall over with a broader sampleset.
For example, what happens when you have rows that otherwise match, but one has "Whatever" in [comments], and the other has null. Both of these rows will be retained using this logic - is this what you want/need?
Pete
- Jeffrey24 years ago
Helper I
I just want to get rid of rows that have the word "Duplicate" in the Comments field. Keep all other rows. If the row had "a;dlkfja;lkdfj;ladkjf;alkjfd;lakfj" I want to keep it. If a row had "adsf;lkaj;lsfkja;lkjfadsf Duplicate" , I want it removed. If a row had null, I want to keep it.
I just think Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate")) should have been enough. To me this is a program error.
- Jeffrey24 years ago
Helper I
BA_Pete to use your wording,
Table.SelectRows(#"Filtered Rows1", each not Text.Contains([Comments], "Duplicate")) should mean:
SelectRows function: give me something that doesn't contain "Duplicate".
If the comment only contains null, then it doesn't contain "Duplicate". Therefore it should be kept.
- BA_Pete4 years ago
Super User
Ah, yes, I see what you mean.
However, a null doesn't contain any text either, so Text.Contains can't resolve to true or false.
As there's no text to evaluate, it has to resolve to null.
For example:
Pete