Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
jdlo_25
Contributor
Contributor

tfilterrow Error filtering column data

Hi Guys,
Good Day! 
I'm trying to work on a project where I need to filter a row with some string on a specific column like "Not". I used the advance mode of the tfilterrow and define the condition: 
input_row.ColumnName.indexOf("Not") != -1 I also tried input_row.ColumnName.contains("Not") 
and it seems to filter out the row with the string on the column on it but it also filter out some rows that has no "Not" on that column.
I figure it out using the rejects output of the tfilterRow because I include the error message and some rows is an error because of the advance condition that I set up.
Is there any more accurate way to filter it out? 
Thanks In Advance
Regards
John 
Labels (2)
3 Replies
Anonymous
Not applicable

Is it possible that  input_row.ColumnName contains nullvalues sometimes ?
jdlo_25
Contributor
Contributor
Author

 Hi djdeejay,
Yes it is possible ! 
Regards
John
Anonymous
Not applicable

in this case input_row.ColumnName.contains("Not") will throw a null pointer exception, as there is no object for which the method contains() can be called.
You Need to ensure you have an object first, you might try this :  
(input_row.ColumnName==null?new String(""):input_row.ColumnName).contains("Not")

you can replace new String("") with new String("Not") if you want to have Default NOT in the NULL case
HTH
PS: if your can ask for equality then it is best practise to use:  "Not".equals(input_row.ColumnName) which reduces to "Not".equals(null) and results into false then