Six Stars

how to call next components after completion of multiple if conditions.

Hi,

 

How to call next components after completion of multiple if conditions.

 

PFA screen shot for your references.

 

How to call after tfileCopy1 to tfileCopy3  is on components OK or if any one or two or all components OK .

 

Then only run the next any components like toracleSP_t etc.

 

Thanks

Shree

 

 

 

Thanks

Shree

17 REPLIES
Moderator

Re: how to call next components after completion of multiple if conditions.

Hello,

This OnSubjobOK (previously Then Run) connection is used to trigger the next subjob on the condition that the main subjob completed without error. This connection is to be used only from the start component of the Job.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Sabira,

 

I have tried that option still l am facing it is not executing by order. 

 

Let me know why it is not executing by order even i declare order by last.

 

PFA file for reference.

 

Thanks

Shree

Moderator

Re: how to call next components after completion of multiple if conditions.

Hi,

 There is no order for If else conditions(order1, order2, order3, order4, order5). The multiple if else conditions will be triggered at the same time as long as  the condition defined is met.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi,

 

Okay, How to achieve if all (if all condition is satisfied or either of). Then only run the next components without trigger subok component.

 

Thanks

Shree

Moderator

Re: how to call next components after completion of multiple if conditions.

Hello,

Would you mind posting your whole job design on forum which will be helpful for us to understand your work flow?

Many thanks.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi there,

 

If you need to guarantee execution order of your conditionally run sub-jobs, then just use multiple tJava components chained via OnSubjobOk triggers.

 

If later you need to know which, if any have of these have run, simply set a flag with tSetGlobalVar in each sub-job, and these can be used in expressions for future Run Ifs etc.

 

Regards,

 

 

Chris

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

Sure, let me try this one.

 

Could you please give flow of components would be very helpful.

.

Thanks

Shree

 

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Sabira.

 

I can't complete job. PFA screenshot for your references.

 

twaitfile: used wait for file. 

tfileist: File placing directory.

tjava2: used to substring the file pattern and store into the context variables.

 

PFA code for tjava2 components. 

 

Thanks

Shree

 

Six Stars

Re: how to call next components after completion of multiple if conditions.

Based on your first screen grab, you would have three tJava components, each with a single Run If (with the same expression you're currently using) and then the sub-jobs from these would each have a tSetGlobalVar after the tFileCopy component setting a Boolean variable to indicate that the sub-job had indeed run.

 

Each of the tJava components would be linked, in the order you wish to sub-jobs to be conditionally executed, with a OnSubjobOk trigger.

 

If necessary, you could reference the Boolean global variables set in each sub-job later in the job to see if any, all, or a specific combination of the sub-jobs ran.

 

Of course, it you just need to know whether ANY of the sub-jobs ran, you can use a single global Boolean variable.

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

Sorry for small change in job.

 

PFA screen shot for your references.

 

If am connect tfilelist ---> interate -->tjava-->run if1, runif

 

if i do this i won't get subok trigger.

 

Thanks

Shree

Six Stars

Re: how to call next components after completion of multiple if conditions.

The tJavaFlex in your example job will have a OnSubjobOk trigger, and it's this component which will be replaced with multiple (probably just tJava) components joined by OnSubjobOk triggers, one for each Run If, to ensure the execution order you require.

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

I have tried that one. But order of run if condition is not loading properly. order 1 trigger after order 2.

 

Any other suggestion, would be very helpful.

 

Thanks

Shree

Six Stars

Re: how to call next components after completion of multiple if conditions.

As I've explained in each of my previous posts, you need to have MULTIPLE components replacing the single one you have which currently has all of the Run If's, in order to ensure sub-jobs are executed in a specific order.

 

Each will have just a single Run If, as follows:

 

ShreeExample.png

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

Okay Let me try this one.

 

Thanks

Shree

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

Could you me give me example for below line.  Bit confusion on tSetGlobalvariable.

 

If necessary, you could reference the Boolean global variables set in each sub-job later in the job to see if any, all, or a specific combination of the sub-jobs ran.

Of course, it you just need to know whether ANY of the sub-jobs ran, you can use a single global Boolean variable.

 

How to set or check multiple run if before proceed to next components?

 

Thanks

Shree

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Shree,

 

I'm not clear what you're trying to do, so will assume you want to just want to run the first of these sub-jobs which matches its relevant condition.

 

 

In each of the sub-jobs you have a tSetGlobalVar component, as per my example above, which sets a variable indicating that it has been run. Let's call it "fileCopied", and set it to true. You will do exactly the same thing, setting this same global variable to true in the tSetGlobalVar component in every sub-job.

 

In all of the tJava components with a Run If, you would simply add the following code to the condition you already have in Run If:

 

&& !((Boolean)globalMap.get("fileCopied"))

What this will do, is ensure the Run If condition WILL NOT be met if the "fileCopied" global variable has been set to true, which will be the case if any of the previous sub-jobs have been executed successfully.

 

As a result, only the first of the sub-jobs will be executed.

 

 

Regards,

 

 

Chris

Six Stars

Re: how to call next components after completion of multiple if conditions.

Hi Chris,

 

I am attaching my jobs. Please have a look once.

 

Mean while i check and try review your points which mentioned in posts.

 

Please let me know if you need any information.

 

Thanks

Shree