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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
MAnywar
Contributor III
Contributor III

Filter Content with tJava before processing.

My job is feed data (content ´)from a NIFI stream, but at times the stream feeds invalid data.

So before the message can be processed through the tExtract, I would like tJava to filter the content, and only allow messages that have a specific XML tag to proceed to downward components.

Is there a possible way I can do this without using the tFilter which is used after the tExtract?

Here is my section of the job with tjava at the start. I wish to be able to tell tJava that any message that does not contain <DG1> should not be read /dropped and the next one be read. How can I proceed with this, without sending null values to tExtract.

I would like to just have the code that I can put inside the tjava that says, if the content of context.NifiMsg contains <DG1> process, else Read next message (if there is any)

 

 

Thank you.

0695b00000YEZrOAAX.png

Labels (5)
1 Solution

Accepted Solutions
Anonymous
Not applicable

It appears that you are reading the file from a hardcoded location and converting it into a String content variable in the tJava. If this is the case, a simple way of doing this would be to simply perform a Java String.contains() search in a RunIf link which replaces your OnSubJobOK following the tJava_2.

 

Something like this ....

 

context.InNifiMsg!=null&&context.InNifiMsg.contains("<DG1>")

 

View solution in original post

2 Replies
Anonymous
Not applicable

It appears that you are reading the file from a hardcoded location and converting it into a String content variable in the tJava. If this is the case, a simple way of doing this would be to simply perform a Java String.contains() search in a RunIf link which replaces your OnSubJobOK following the tJava_2.

 

Something like this ....

 

context.InNifiMsg!=null&&context.InNifiMsg.contains("<DG1>")

 

MAnywar
Contributor III
Contributor III
Author

Thanks so much. this saved me a lot.