Get error when trying to use component context variable in tRunJob

Highlighted
Five Stars

Get error when trying to use component context variable in tRunJob

Hi!

 

I'm trying to figure out a way to start the same job with diffrent parameters. I know there are a lot of ways of doing it but I'm tryin to use tRunJob for it. See what happens below

 

First I run the child job on its own and it works fine with the context parameter

child job works with context parameter.png

 

I then set the context variable in the child job to null and sets the value in the tRunJob instead, in its context page and it works fine, see below

parent job works with context parameter.png

 

Now i set the context variable in the context page to NULL and then I want to use the context variable in the tRunJob component, see below

parent job with component context parameter.png

 

But when running it I get an error that I can't figure out the reason for, see below

parent job not working with component context parameter.png

 

I'm not sure what I am do wrong. This is what it says in the help about tRunJob

 

Context Param

You can change the value of selected context parameters. Click the [+] button to add the parameters defined in the Context tab of the child Job. For more information on context parameters, see Talend Studio User Guide.

The values defined here will be used during the child Job execution even if Transmit whole context is selected.

 

And thats the reason I thought I could use it this way. pls help

 

Regards

Patrik

 

 

 

 

 

 


Accepted Solutions
Highlighted
Community Manager

Re: Get error when trying to use component context variable in tRunJob

The reason you are having an issue here is that the Context Param section of the tRunJob is essentially interpreted as a single line of Java. This has many advantages in that you can make method calls, etc, but it means that you need to pass values as you would in code. If you are passing a String in Java you would need to wrap it in double quotes. Therefore you need to add...

 

"TYPE='MODEL'"

View solution in original post


All Replies
Highlighted
Community Manager

Re: Get error when trying to use component context variable in tRunJob

The reason you are having an issue here is that the Context Param section of the tRunJob is essentially interpreted as a single line of Java. This has many advantages in that you can make method calls, etc, but it means that you need to pass values as you would in code. If you are passing a String in Java you would need to wrap it in double quotes. Therefore you need to add...

 

"TYPE='MODEL'"

View solution in original post

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 3

Read about some useful Context Variable ideas

Blog