Two Stars Jon
Two Stars

Order of execution

I am having difficulty understanding how Talend runs the components of a job.

 

In the screen-shot below, I read a varchar from a Microsoft SQL Server table (table has only one row and one column, with a varchar (10) containing ‘190’).

I then want to store this string in a Variable for later use.

 MyJob.png

 

The components seem to execute in parallel, instead of one after another. I see from the forum that this is a common problem, but I don’t understand it.

tJava_1 contains the simple code shown below, but it always displays Null instead of the expected string ‘190’.

 

tJava_1 contains this simple code –

 

System.out.println("tJava_1 " + (String)row2.Num_Days);

globalMap.put("myKey", (String)row2.Num_Days);

System.out.println("myKey is " + globalMap.get("myKey"));

 

Here is what I get –

 

Starting job Medora_test_Copy_2_Copy at 10:40 01/09/2017.

 

[statistics] connecting to socket on port 3734

[statistics] connected

tJava_1 null

myKey is null

Num_Days: 190

[statistics] disconnected

Job Medora_test_Copy_2_Copy ended at 10:40 01/09/2017. [exit code=0]

 

It looks like the code in tJava_1 executes before tMSSQLInput_1 has even started reading from SQL Server.

 

How can I stop the tJava_1 component from executing until the tMSSqlInput_1 component has finished please?

Is there an explanation on the web of how Talend controls order-of-execution of the components please?

 

I think I understand why I am confused, but not how to escape from the confusion

 

Regards

Jon

 

R.J Lester

Data Warehouse Developer

Customer Support and Innovation Centre

Maidstone & Tunbridge Wells Trust  Phone: 01622 225616 

Email: jon.lester@nhs.net 

 

  • Data Integration
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Nine Stars TRF
Nine Stars

Re: Order of execution

The order is what you expect but the result on the console (from tLogRow) comes when the job is finished.

Change the tJava by a tJavaRow component to access the tMSSQLInput_1 result (get the fileds value using input_row.Num_Days instead of row2.Num_Days).


TRF
3 REPLIES
Nine Stars TRF
Nine Stars

Re: Order of execution

The order is what you expect but the result on the console (from tLogRow) comes when the job is finished.

Change the tJava by a tJavaRow component to access the tMSSQLInput_1 result (get the fileds value using input_row.Num_Days instead of row2.Num_Days).


TRF
Two Stars Jon
Two Stars

Re: Order of execution

Thanks very much TRF,

My small job works fine now!

I didn't understand the tJavaRow_1 component, so I had not tried it until I saw your answer.

This Talend Open Studio is very useful and I think it should be used more in the NHS (National Health Service, ie healthcare in the UK)

Regards

Jon

 

Nine Stars TRF
Nine Stars

Re: Order of execution

Great! Thank's for the Kudo.

I'm not Smiley Sad from Talend, but Talend people will be happy of your comment.

You're welcome if you need more help.


TRF