How do I filter out rows where a column contains a quote symbol (")

Six Stars

How do I filter out rows where a column contains a quote symbol (")

Hi folks,

 

I'm trying to set up a filter in tMap input that removes rows where a string column contains a quote symbol in the string (").  And also removes rows where the email is blank.

 

My attempt at this expression looks like this:

row1.UMB_Student_Email != null && !row1.Permanent_Street.contains("\"")

But I keep getting an error that says "Exception in thread "main" java.lang.Error: Unresolved compilation problems:"

 

And I can't tell where I'm going wrong.

 

Can you help?


Accepted Solutions
Five Stars

Re: How do I filter out rows where a column contains a quote symbol (")

The source value may be a blank instead of null. tweak your statement like below and should work.

!("").equals(row1.UMB_Student_Email) && !row1.Permanent_Street.contains("\"")

Thanks & Regards

Naveen

Thanks & Regards
Naveen

All Replies
Five Stars

Re: How do I filter out rows where a column contains a quote symbol (")

The source value may be a blank instead of null. tweak your statement like below and should work.

!("").equals(row1.UMB_Student_Email) && !row1.Permanent_Street.contains("\"")

Thanks & Regards

Naveen

Thanks & Regards
Naveen
Highlighted
Six Stars

Re: How do I filter out rows where a column contains a quote symbol (")

My apologies it took so long to test and reply.

 

I tried the code and still get the error.

 

I agree that the email should have been checked as a string, but I think the Permanent_Street (address field) is the culprit, where I'm trying to check whether the string in that field contains a quote (") in the string itself.

 

I'm not confident my code that is checking for the quote (") is right but I cant find what is the right combination no matter how hard I google.

Six Stars

Re: How do I filter out rows where a column contains a quote symbol (")

Actually.. I'm sorry Naveen.  The code seems to work when I add test variables, but without the variables it still produces the error in the test window. And the red box error at the end of the expression scroll-bar is always there. I'm not sure whats going on, but I'm rolling with it.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.