Task Flow Compare Active stdout and PrevTask stdout - VisualCron - Forum

Community forum

reynoldsmg
2021-10-18T15:24:08Z
I have a job that performs two tasks. Each task performs a file checksum of a file. On the completion of the second task, I want to compare the StdOut of the Active task with the Previous Task. If they are different, I want to perform Action A. If they are the same, I want to perform Action B.

It seems that my comparison never correctly evaluates the two stdout values.

I am attaching a screenshot of my task flow configuration.

Gary_W
2021-10-18T18:53:22Z
You should be able to do something like that in the flow of the second task. I do something similar where I do a check on success to compare a count for example then send a success or fail e-mail. See pseudocode below.

task a - task a output
task b - task b output
  on success flow of task b
     if other value
        {STRING(CountOccurencies|<taskaSTDOUT>|<taskbSTDOUT)} = 1 (then they are equal)
           Go to task c - uncheck "run following tasks in order"
  on success flow of task b
     if other value
        {STRING(CountOccurencies|<taskaSTDOUT>|<taskbSTDOUT)} != 1 (then they are not equal)
           Go to task c 
task c - run of checksums are equal
task d - run of checksums are not equal
reynoldsmg
2021-10-18T19:22:50Z
Do you have any experience using Active|StdOut and PrevTask|StdOut? I'm trying to use these relative variables without having to enter task guids into the flow.

Gary_W
2021-10-18T19:34:42Z
Sure, the trouble is remembering to update them if you move tasks around. You could always save the various STDOUTs into variables and query those.
Joey S
2021-10-20T21:13:11Z
The only way I can think would be 4 Tasks

Task #1 = Your first check
Task #2 is your second check

Task #3 is your 'Action' if they are the same
Task #4 would be the alternate 'Action' if they are different

On Task #3 you would have a condition. That condition would look at the Previous Task (#2) and Compare it with Task #1. Neither Task #1 nor Task #2 are the "Active Task". Set it like this
image.png
Where you reference the current job (in "Job Name") and Task #1 (in "Task Name") (Note* - My task #1 is the 'Execute' task)

Here is the trick. From that screen go up one level to Add/Update Condition Set. Click on on Actions
image.png

Leave "On Match All" as "Continue
- "Continue" in this context will mean that Task #3 will run if the condition is met, ie. "Continue on with Task #3"

image.png

On "On Match None" point that to Task #4 (my example is a powershell task)
image.png

Double Check all of your Flows for your tasks to make sure that Task #3 does not Continue when it is Successful or Completes
Here is what Task #1 and #2 should look like
image.png

Here is what Task #3 should be
image.png

The flow for Task #4 is irrelevant



The down side to doing it this way would be that you have to specifically call out the job and task outputs in the Condition and you have to call out the specific job and task in the condition Action. And that you have to make a new condition for any comparison like this that you want to make. This condition can't really be reused for any other job and must remain "with" the job if you move to a new server, perform a restore, etc.









Scroll to Top