How to start the job based on month

Six Stars

How to start the job based on month

a.PNG1st flow : when month is given as march. only on that month this job should triggeb.PNG2nd flow : except march month .remaining month it should runc.PNGdate input file. based on this date i have run the job

 

Requirement:

Quarter : mar,jun,sep,dec

client will give the input file as mar-17 based on that i want to trigger the flow

1.whenever the input file has month as mar then i want to run 1st flow  and 2nd flowshould not run.

2.whenever the input file has month as jun,sep,dec then  i want to run 2nd flow and 1st flow should not run.

so whole flow will be in single job. How to implement this


Accepted Solutions
Sixteen Stars

Re: How to start the job based on month

These are the steps you will need.....you will learn more by implementing them yourself using the online Talend documentation.

 

1) Identify the month. Use the TalendDate routines to help with this. Check out Java date formats to help translate the String date you receive.

2) Store this date in a context variable or the globalMap

3) Use a tJava as a base for your conditional logic

4) Connect RunIf links to your tJava and then to your respective SubJobs which process the data according to month. Use the value you stored in your context variable or globalMap to trigger the IF conditions. This post talks about RunIf links (https://community.talend.com/t5/Design-and-Development/How-to-use-Trigger-Run-If/td-p/3333)


All Replies
Sixteen Stars

Re: How to start the job based on month

These are the steps you will need.....you will learn more by implementing them yourself using the online Talend documentation.

 

1) Identify the month. Use the TalendDate routines to help with this. Check out Java date formats to help translate the String date you receive.

2) Store this date in a context variable or the globalMap

3) Use a tJava as a base for your conditional logic

4) Connect RunIf links to your tJava and then to your respective SubJobs which process the data according to month. Use the value you stored in your context variable or globalMap to trigger the IF conditions. This post talks about RunIf links (https://community.talend.com/t5/Design-and-Development/How-to-use-Trigger-Run-If/td-p/3333)

Six Stars

Re: How to start the job based on month

Not able to store date column in string format using context or global map.

can you explain me.

Six Stars

Re: How to start the job based on month

Thanks, got the month as per your logic.

But i can able to find the conitional logic.

this is my flow

b.PNG

a.PNGgot month as output in tjava

 

based on my tjava. i need to run the process separately.

Sixteen Stars

Re: How to start the job based on month

Right click on the tJava and select "Trigger" and then "RUn If". Connect it to one of your SubJobs. Do this for each of your SubJobs. Then, to set the condition, click on the link and you will be presented with a space to put your conditional logic in the "Component" tab.

Six Stars

Re: How to start the job based on month

a.PNGb.PNGc.PNG

i ahve give the condition correctly. but before going to the condition it is failing.

1. only for if(order1) we have to give condition

2. for if(order2) no need to give condition?

Forteen Stars TRF
Forteen Stars

Re: How to start the job based on month

As there is no "Else" trigger, the condition is required for each "If" trigger.

TRF
Sixteen Stars

Re: How to start the job based on month

@TRF is correct, but your problem is that you have a semicolon in the condition. Remove the semicolon and it should work