Ask Your Question

streamsets - help with replace value in a field

asked 2018-07-02 12:40:54 -0500

anonymous user


updated 2018-07-02 12:44:34 -0500


I am using expression evaluator to replace a value in a column/field but streamsets is throwing error. More details: Input file is pipe delimited file with two columns. field1 field2 test string: 1|"Test" the string. I want to replace the value "Test" with Test with no quotes. I am using this field expression in expression evaluator ${str:replaceAll( record:value(‘/Field2’), "\"Test\"”,"Test")}

Please help me with this

edit retag flag offensive close merge delete


What is the exact error?

jeff gravatar imagejeff ( 2018-07-02 13:06:49 -0500 )edit

EXPR_00 - Invalid expression '${str:replaceAll( record:value(‘/field2’), "\"Test\””,"Test")}': com.streamsets.pipeline.api.el.ELEvalException: CTRCMN_0101 - Error parsing expression ${str:replaceAll( record:value(‘/field2’), "\"”,"")}: javax.servlet.jsp.el.ELException: Encountered "\u2018", expected

Robot gravatar imageRobot ( 2018-07-02 13:11:04 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-07-02 22:13:22 -0500

iamontheinet gravatar image

This should work using Field Replacer processor ${str:replaceAll(record:value('/Field2'),"\"",'')} Here's a working example where extra double quote in "name_1"" has been replaced with '' (nothing/null) resulting in "name_1":

image description

However, note that default data type of column values when read from text file is String so they all will end up surrounded in double quotes anyways--unless you specifically convert to a different data type (INTEGER, FLOAT, BOOLEAN, DATETIME, etc.) using Field Type Converter. So unless there's a chance "Test" will have an extra double quote in it that you'd like to replace with '' (nothing/null), I'd leave this rather unnecessary processing step out because there's no difference in reading values Test and "Test" from text file.

Hope this helps.

edit flag offensive delete link more


Thank you!

Robot gravatar imageRobot ( 2018-07-08 21:12:13 -0500 )edit

You're welcome!

iamontheinet gravatar imageiamontheinet ( 2018-07-09 08:55:19 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-07-02 12:40:54 -0500

Seen: 1,067 times

Last updated: Jul 02 '18