Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Calculation Fields

I have a field in a table that contains strings. I have another field in the same table that is boolean. I'm trying to figure out how to set the boolean field to True is the string field contains a sub-string. Can someone help?

2 Community Answers

Matillion Agent  

Ian Funnell —

Hi Dan,

You will need a Calculator component for this. Add a new field and set it to a SQL expression which will return true or false.

For example, this is the syntax you would need on Redshift

CASE WHEN "yourcolumn" LIKE '%somestring%' THEN true ELSE false END

You would then have the choice of updating the target table (using a Table Update component) or else creating a new table with the boolean field set how you want it. If there are many updates then the second approach will probably be more efficient.

Best regards,
Ian


Dan Dow —

That worked, thanks!

Post Your Community Answer

To add an answer please login