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


smfmotor
2019-11-01T10:16:58Z
I have a job containing the following tasks:
- List files on an SFTP site, using flow control to gracefully exit and stop the job if no files found or continue with the file if one is found
- Download the file from SFTP to a local directory
- Call a batch database process to load the file

That's all working fine, however this is a monthly file that could arrive anytime around the end of the month. What I'm looking to do it have an additional task that runs on the 10th of the month to push a notification if the database process task hasn't run successfully in the last 20 days (this is so that we can chase up the file with the vendor).

Looking at the conditions I can add to the nofitication task, {DATEFORMAT(dd)} equaling 10 is simple enough, but I can't quite work out how I would evaluate that {TASK(229d1e60-111b-4b9d-9a3e-af1cfa7aeb5d|LastRun|dd/MM/yyyy)} is >= {DATENOWADD(Days|-20|dd/MM/yyyy)}. I'm new to VisualCron so suspect this is a simple question of me not knowing where to enter these values, but I can only seem to see "equal to" type operators in the conditions entry section. Or is it possible to use a mathematical evaluation against 2 dates? Perhaps something using Julian dates?
Sponsor
Forum information
thomas
2019-11-01T13:36:27Z
This really should have worked.. :)

The number of days between two dates (You should substitute with last execution and todays date):
{DATE(DaysBetween|01.11.2019|01.12.2019)}

Check if this is greater than 20 (paste the below snippet into variables window to see how it works, change dateformat if needed):
{LOGIC(If|Integer|{DATE(DaysBetween|01.11.2019|01.12.2019)}|>|20|true|false)}

This returns true in the variables window. However when I try to assign it to a variable in 8.5.5 it evaluates to false.

Variable window
Capture.PNG

Assign to variable
Capture.PNG

Result
Capture.PNG

Maybe support can explain why this happens? I can't see where I am goin wrong here.


smfmotor
2019-11-01T15:48:16Z
Thanks Thomas, you've sent me down the right path here. I used this formula:

{LOGIC(If|Integer|{DATE(DaysBetween|{TASK(ac0f216d-065e-4756-9301-806b2e214217|LastRun|dd/MM/yyyy)}|{DATENOWADD(Days|-20|dd/MM/yyyy)})}|>|20|true|false)}

In the variable window, this evaluates as true against a job that has never run, then when I run that target job (i.e. update LastRun to today), it evaluates false.
When I then transfer that same string to a variable creation step, it works in the same way.
Finally, I tried creating a condition with that string as Value 1 with equals operator against true as Value 2 . That then controls whether that task runs, based on whether the target task ran in the last 20 days.

I'm not sure why your version didn't work, but this was definitely the solution for me - I just hadn't spotted the logic section in the variable builder.

Thanks for your input on this!

task example.jpg
Scroll to Top