Setting group variables

Paul Watson (101 posts)
May 1, 2017 04:34 PM
Accepted Answer

I believe I see documented ways in which jobs can set the value of current job variables. However, what I am looking for is a way to set a group variable. Below is a simplified example of the situation.

I have ~20 jobs in a group. The same code is run for monthly, quarterly, and annually.

I would like to have three (3) jobs to start each type of cycle; "Start Monthly", "Start Quarterly", and "Start Annual".

Each one of these jobs would set a group variable RUN_TYPE to a value of "monthly", "quarterly", or "annual".

The RUN_TYPE variable would be inherited by all jobs in the cycle.

Is there a way to accomplish this?

Bill Staff (599 posts)
May 4, 2017 06:33 PM
Accepted Answer

You can use a Job Variable Update Task to do this. It has an option that determines what level the variable is updated at. So, just as you said, you would have a job that sets the variable to monthly, then kicks off the first job in the chain, or whatever is appropriate.

Note that if you jobs are all chained together using Responses, you can accomplish the same thing by just defining the variable in the first job (using the Variables tab in the job--not with a task). The value will be passed through to all jobs in the chain. But this only works if you're using Responses to link them all together. If you're using triggers that start the jobs independently (or running them manually, or if you might need to restart them manually during the cycle), you need to go with your original idea and set the variable for the group.

Paul Watson (101 posts)
May 4, 2017 07:24 PM
Accepted Answer

Many thanks, Bill. I see it now. I had assumed that a "Job Variable Update Task" would only update the variable for the current job instance.

Is there any connection of the Group variable with the current cycle?

The financial close has about 15 jobs and is written such that both the monthly and quarterly close can run concurrently. The jobs MonthlyClose and QuarterlyClose each start a new cycle. If the MonthlyClose job sets the CLOSE_TYPE to "monthly," then the QuarterlyClose job starts and sets the CLOSE_TYPE to "quarterly," will the chain of jobs get the CLOSE_TYPE value for their "cycle?"

Bill Staff (599 posts)
May 5, 2017 04:45 AM
Accepted Answer

There is a correlation between the variable and the cycle ID in that they work the same way, with the same limitations: if the jobs are running in a linked chain (tied together by Responses or Job Triggers), then each subsequent job will get its variables and cycle ID from the previous job in the chain.

If the jobs are not linked in that way, then each job gets the current cycle ID and variables at the time it starts executing.

So if you have overlapping cycles, the jobs have to be explicitly chained together for either to work--otherwise adTempus would have no way to know that they belong to the same cycle.

Replies are disabled for this topic.