• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] HOW TO DEFINE AN INCREASING VARIABLE

#1 2011-12-27 09:02:21

cinar
Member
Company: OBASE
Registered: 2011-11-14
Posts: 58

[resolved] HOW TO DEFINE AN INCREASING VARIABLE

Tags: [oracle, variable]

Hello,

I have a subjob which is running 28 times, and I need to have a variable in subjob which will starts from 1 and increase one by one untill 28.
How can I define a variable which will increase one by one at each run of subjob?

Thanks.

Offline

#2 2011-12-27 09:11:44

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Hi

You can add a context variable in Contexts tag.
Then modify your job as follows.
tLoop(28 times)--Iterate-->tJava--Iterate-->subjob.

Code:

//Java code in tJava
context.new1=((Integer)globalMap.get("tLoop_1_CURRENT_VALUE"));
System.out.println(context.new1);

Best regards!
Pedro

Last edited by pedro (2011-12-27 09:35:07)


Only Paranoid Survive.

Offline

#3 2011-12-27 09:25:45

cinar
Member
Company: OBASE
Registered: 2011-11-14
Posts: 58

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Thanks for your response. But How will I get the variable in my subjob?

Offline

#4 2011-12-27 09:29:58

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Hi

Context variable is a global variable and you can get it with most components.
Ctrl+Space. Then you will find it in the first place.
Or you mean you have used a tRunjob?

Best regards!
Pedro


Uploaded Images

Last edited by pedro (2011-12-27 09:32:43)


Only Paranoid Survive.

Offline

#5 2011-12-27 09:49:19

cinar
Member
Company: OBASE
Registered: 2011-11-14
Posts: 58

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Yes, I've used TRunjob which is linked to another job - runs 28 times-, and I need a variable that must have  an incremental value in the subjob.
For example;

at first run of my subjob, i must have a variable such as context.xxx which has value of 1.
at second run, it must increase to value of 2.
at third run, it must be 3.

So I can use this variable in any component in my subjob.

Offline

#6 2011-12-27 10:25:33

pedro
Member
Registered: 2011-11-17
Posts: 3682

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Hi

Add a context variable in your subjob.  ----context.subjobvalue
Add a context variable in your mainjob. ----context.new1
Set tRunjob component as follows.
Then context.new1 in mainjob will be passed into context.subjobvalue in subjob.

Best regards!
Pedro


Uploaded Images


Only Paranoid Survive.

Offline

#7 2011-12-27 11:05:44

cinar
Member
Company: OBASE
Registered: 2011-11-14
Posts: 58

Re: [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Thanks for your help. I resolved the problem by combining your ideas with my Talend knowledge.

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] HOW TO DEFINE AN INCREASING VARIABLE

Board footer

Powered by FluxBB