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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tFilterRow - Filter a field that contains values in the context

Hello, I want to filter a string field "EVENT_NAME" to the values in my context. My context.event is A, B, C and D.
So in the tFilterRow Advanced mode, I want to code something like this input_row.EVENT_NAME.equals(context.event). I mean input.row.EVENT_NAME.equals("A","B","C","D")
Is there a way to do it? Could you provide me the syntax to get this filter works.
Thanks in advance!
Labels (2)
3 Replies
_AnonymousUser
Specialist III
Specialist III

Hello,
If I understand your problem correctly, your context variable context.event can only contain "A", "B", "C", and "D". In that case you can just use input_row.EVENT_NAME.equals(context.event) in your filter, and it should filter out all other values.
If you want to check if your field EVENT_NAME contains only one of the allowed values, you can use :
"ABCD".contains(input_row.EVENT_NAME) && input_row.EVENT_NAME.length() == 1
the second part ensures that your field is only one character, so that "AB" doesn't match for instance.
Anonymous
Not applicable
Author

Hi,
The input_row.EVENT_NAME.equals(context.event) is what I want to do to get all the rows which have "A", "B", "C" and "D". However I don't get any match. I get zero rows in my output. In my data has some "A", "B", so I should get some matched rows.
I don't know if I miss anything?
Thank you for your help!
talendtester
Creator III
Creator III

Use tFilterRow combined conditions Or advanced condition:


input_row.columnName.contains("A")||

input_row.columnName.contains("B")||

input_row.columnName.contains("C")||

input_row.columnName.contains("D")||

 

Similar to:

https://community.talend.com/t5/Design-and-Development/Filter-Rows-by-Substring/m-p/74084