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: 
rp2018
Creator
Creator

How to pass context variable value from TAC to a job?

I have 2 jobs setup in TAC, one runs at night and one runs at daytime.    When 1st job runs, it should pass a value 'A' and 2nd job runs, it should pass a value 'I'.  Context variable is called PassRunValue.

Inside both of these two jobs, I've defined the context variable PassRunValue = "A" for job1

and PassRunValue = "I"  for job2.

 

How can we pass the value from TAC to the a job?

 

my job has 

tjava--->if 'A'--->tmssqlinput--->tlogrow

tjava--->if 'I''--->tmssqlinput--->tmssqloutput

 

Currently tjava contains:  context.PassRunValue = "";

Labels (3)
4 Replies
Anonymous
Not applicable

I don't know how to make that work, if I'm understanding your setup correctly.

 

I have a job that has to run at midnight before some other jobs that run every hour. I have a tJava component that sets the context variable "isMidnight", and I use "run if" links from it to choose a different set of subjobs to run based on the time.

rp2018
Creator
Creator
Author

Can you show the setup with the screen shot. I'm trying to see how you are setting  context variable "isMidnight".

Anonymous
Not applicable

Here's the if logic

0683p000009LzHr.png

The "InitializeContext" tJava component contains:

ZonedDateTime thisHour = ZonedDateTime.now(ZoneId.of("US/Pacific")).truncatedTo(ChronoUnit.HOURS);
context.isMidnight = thisHour.getHour() == 0;

The "Run if" conditions are then just simply "context.isMidnight" and "!context.isMidnight". This is the Stackoverflow post with the general approach:

https://stackoverflow.com/questions/24504935/skip-a-component-based-on-condition-in-talend

 

rp2018
Creator
Creator
Author

I'm trying to understand, when I pass the value for PassRunValue variable from TAC, does it overwrite the value set in tjava?

 

1.  Passing PassRunValue = "A" from TAC

2.  Job has tjava component, which has value of  context.PassRunValue = "";

3.  Would tjava component set the context variable context.PassRunValue = "A" ?