Execute Groovy validators in Job flow

One Star emo
One Star

Execute Groovy validators in Job flow

The Excel files that I upload are like snowflakes, no two are alike! To speed up development time, I'd like to access our Groovy/Grails domain class validators prior to the upload of each row.
I've tried many suggestions both on this forum and outside. The most promising is to bind to the globalMap using tGroovyFile and then call it from a tJava component, but tGroovyFile throws a groovy.lang.MissingPropertyException: No such property: globalMap for class: Script1.
The example code in the Groovy file is:
globalMap.put("GroovyObject", new MyGroovyObject())
class MyGroovyObject {
def myMethod(row) {
// Do anything you want with the row
// update the row directly like
row.email = row.email + "_TEST"
It errors out before even getting to the tMap. Is there something I'm missing? (I'm a Groovy noob.) Is there example code somewhere?
One Star

Re: Execute Groovy validators in Job flow

This blog post has a video that shows how to use groovy with Talend:
Here's another post that describes how to get data out of groovy (say a validator result and error messages object).


Re: Execute Groovy validators in Job flow

Thanks for the blog posts Carl!
One Star emo
One Star

Re: Execute Groovy validators in Job flow

Hi walkerca,
I have seen the first link, and the issue I have is that tGroovy and tGroovyFile only run once at the beginning of the job, and the code needs to run for every row. The second link looks promising and is one I haven't seen before. I'll work with it to see if it solves my problem.
Thank you for your response!

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Definitive Guide to Data Quality

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



Introduction to Talend Open Studio for Data Integration.


Downloads and Trials

Test drive Talend's enterprise products.