In Applications Manager, the use of incrementing Substitution Variables (subvar) may be required for various actions to be performed a specified number of times only.
An incrementing subvar is a subvar thas resolves to a number that will increase by one each time the subvar is evaluated. Once it reaches a specified number, another action can be taken.
Some examples scenarios:
Applications Manager
There are a couple ways to create an incrementing subvar. Both ways, increments a subvar value by one, performs and action such as restarts the Job on Abort, and once it reaches a certain value, another action is taken.
The first method uses 2 subvars, one to sets a value to be incremented and one to increment the first subvar value. Below is an example condition configuration:
Image shows the following 4 rows for Conditions on FAIL_TEST Job:Order: 1; Timing: BEFORE; Performed: ONCE; Condition#1: ALWAYS TRUE; Qual: =; Condition#2: ALWAYS TRUE; Action: SET SUBVAR; Action Argument: #count_tries=0Order: 2; Timing: BEFORE; Performed: CONTINUOUS; Condition#1: ALWAYS TRUE; Qual: =; Condition#2: ALWAYS TRUE; Action: SET SUBVAR; Action Argument: #count_tries={#increment}Order: 3; Timing: BEFORE; Performed: CONTINUOUS; Condition#1: {#count_tries}; Qual: GT; Condition#2: 15; Action: SET SKIP STATUS; Action Argument: Max triesOrder: 4; Timing: AFTER; Performed: CONTINUOUS; Condition#1: STATUS; Qual: =; Condition#2: ABORTD; Action: RESTART ON ABORT; Action Argument: Y
Here is #count_tries subvar:Image shows Substitution Variables: #count_triesName: #count_triesType: NumbersNothing else filled in
Here is #increment subvar:
Image shows Substitution Variables: #incrementName: #incrementType: NumbersSql statement: select {#count_tries} +1 from dual
The following behavior is expected with this condition configuration:
Condition 1 - set or resets #count_tries value to 0. This is performed only once.
Condition 2 - increments #count_tries by 1
Condition 3 - If #count_tries value is greater than 5, set SKIP status with custom status value "Max Tries". Change this accordingly.
Condition 4 - Restart on Abort status
As seen below, with this condition set up, a Job Aborts 5 times before skipping with a Max Tries status.
The second method is more simple and parses the JobID, the subvar can be used in multiple Jobs without issue. However since it is using 1 condition, there is less options in what actions can take be taken.
In the below example, the Job restarts 5 times before no longer restarting resulting in the 5th restart staying in Abort status. Here is the condition configuration:Image shows Conditions on FAIL_TEST:Order: 1; Timing: AFTER; Performed: CONTINUOUS; Condition#1: {#failcount}; Qual: LT; Condition#2: 5; Action: RESTART ON ABORT; Action Argument: Y
Here is #failcount subvar. Image shows Substitution Variables: #failcountName: #failcountType: NumbersSql statement: select nvl(substr('{jobid}',length(cast ({jobid} as int))+2),0) from dual