Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Vicky Peck
2018-08-08T15:30:39Z
I have a job that only should be executed if the result of a query equals 1.
The principle is
1) check if an update is complete (return 0/1 from sql query)
2) if 0, wait 5 minutes and do the check again
if 1, execute all tasks of the job
3) there is a timeout defined on the job: job takes longer than 1 hour, throw exception in order to stop the job and send a notification.

I currently have as first task in the job a task that outputs the 1/0 queryresult. That result is used in the condition.
But now I need to use the same condition for a second and probably a third job. Is there not a way to implement a more generic condition, without the extra task in every job?

Thanks in advance for the help!
Sponsor
Forum information
thomas
2018-08-09T10:54:12Z
You can write generic conditions that just looks at the result of the previous task, ie don't point to a specifi taskid. We have a few generic conditions that are used all over the place. The last two in the picture are similar to what you need I guess:

Capture.PNG
Vicky Peck
2018-08-09T11:26:53Z
Thanks for the response. Checking against the previous task is already a good thing but as my job needs to retry until the result is satisfactory OR the timeout has expired, I also add in the actions a "Run Task" and define the job and task there. Can you also do this with a generic "previous task"?

Capture.PNG
thomas
2018-08-09T13:03:06Z
I have to think about this one a bit..

Just so I understand correctly:

You have one query. When/If this query returns 1, you proceed with the rest of the job. If it times out => notificiation.
in the second/third job, do you want to check the result of the same query, or another query?
Vicky Peck
2018-08-09T13:11:56Z
Indeed. And every time we check the same query.
thomas
2018-08-09T14:40:59Z
Maybe like this:

Create 3 jobs (or whatever), that does your reporting part.
Job 1: Create report1
Job2: Create report 2
Job 3: Create report 3

Create a master job that checks query with tasks :
Check query
If result = 0 then wait and try again
If result = 1 then:
Run job 1
Run job 2
Run job 3

This way you are checking the query in one job. Wouldn't this work?


Vicky Peck
2018-08-09T14:48:04Z
It would if they needed to be executed on the same frequency but that is unfortunately not the case:
Job 1: every day at 8am
Job 2: every monday at 1pm
Job 3: every 1th of the month at 6pm

Such a same you can't use the result of a query directly in the condition. I am probably asking too much and should just copy 😢
And thanks for trying to find a decent solution!
thomas
2018-08-09T22:21:06Z
Ok. Put the sql task in a separate job. In the three other jobs, call this job and check the result from the query. You will still have to add this step in each, but at least the query is stored in one place only.
Scroll to Top