O'Reilly logo

Talend Open Studio Cookbook by Rick Barton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating validation rules for more complex requirements

Sometimes validation rules require multiple inputs to provide a pass/fail result, so it is often easier to build and understand the code if it is written using Java.

If you aren't familiar with code routines in Talend, it is recommended that you first complete the recipe Creating custom functions using code routines, Chapter 5 , Using Java in Talend that will take you through the setup of code routines.

Getting ready

Open the job jo_cook_ch03_0060_validationCodeRoutine.

How to do it…

  1. Create a new code routine called validation, and copy the following code into it:
     /** * validateCustomerAge: Check customer is 18 or over for UK, 21 or over for rest of world. * returns true if valid, false if invalid ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required