Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

conditional job

hi gays, 

i work for project automation migration data from database to another .

i create 3 job 

job 1 for migration data from Sql server to oracle

job 2 for migration data from oracle to oracle

i want to create a job parent for test ;

if CMD line content the context param of job 1  then run job 1

else run job 2 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

thinks for your response

i can parse parameter database with tjava to child job ?? 

 

View solution in original post

14 Replies
Anonymous
Not applicable
Author

The tContextLoad needs to be used as shown in the example here ...(https://help.talend.com/reader/jomWd_GKqAmTZviwG_oxHQ/xH2TyYr_AmQnKwOYlqVCvA).

 

If you are passing the value to your job using the CMD line, you do not need to worry about the tContextLoad. Simply use a tJava where your tContextLoad component is and link the RunIfs from there.

Anonymous
Not applicable
Author

thinks for your response

i can parse parameter database with tjava to child job ?? 

 

Anonymous
Not applicable
Author

The tJava is used simply as a dummy start component. You are really just relying on the RunIf links.

Anonymous
Not applicable
Author

 

hello, 

i create the job with component tjava 

java Code in tjava:


String contextsqlserver_Database;

if (contextsqlserver_Database != null){
globalMap.put("isNull", true);
}

else {
globalMap.put("isNull", false);
}

 

i want to test if contextsqlserver_database is parsed in cmd line with value , the job executed is job 1

the condition in run if 1

(Boolean)globalMap.get("isNull")==true

else 

run job 2 

 

the issus : contextsqlserver_database may not have been initialized

have you another solution

thanks

 


jobgénirique.jpg
Anonymous
Not applicable
Author

How are you passing the context variable in the command-line? This seems to be the problem.

 

What is your requirement for passing the context variable, how are you starting the job and can you use other functionality to do this? 

Anonymous
Not applicable
Author

hi,

because i work for automation project and i want create a pipeline for migration data from 

sqlserver-------> oracle

oracle ------> oracle 

and i want to insert the command line in scriptshell 

 

Anonymous
Not applicable
Author

I understand that, but you said that you were not sure the context variable value was being passed correctly. How are you passing the context variable in the command-line?

 

Anonymous
Not applicable
Author

i build a job and run this commande : 

databaseTransfer_run --context_param contextsqlserver_Port=............. --context_param contextsqlserver_Database= ..... --context_param contextsqlserver_Schema=..... --context_param contextsqlserver_Password=....... --context_param contextsqlserver_Login=........ --context_param contextsqlserverr_Server=........ --context_param OracleConnection_Port=........ --context_param OracleConnection_Sid= ........... --context_param OracleConnection_Password= ........ --context_param OracleConnection_Login=............. --context_param OracleConnection_Server=.............--context_param OracleConnection_Schema= .................

Anonymous
Not applicable
Author

OK, that looks like it should be working. The next thing to test is that the values are getting through. To do this, add some code to your tJava to print out the values of your context variables. For example,....

 

System.out.println("Context named Test ="+context.Test);

This will show whether the values are reaching your job.