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


James Hagist
2020-04-17T15:14:25Z
So how would I go about creating this filter? The date tab doesn't give me an option to set it to equals to.
Sponsor
Forum information
Support
2020-04-20T08:19:11Z
Originally Posted by: James Hagist 

So how would I go about creating this filter? The date tab doesn't give me an option to set it to equals to.



Hi James,

You can use variables for this such as {DATE(WeekDayNumber|Friday)}
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
James Hagist
2020-07-14T14:22:30Z
Sorry I missed this response but I understand the function but where would I put that in a task?

In the date filter?

An example would help... thanks

Support
2020-07-16T13:26:19Z
Originally Posted by: James Hagist 

Sorry I missed this response but I understand the function but where would I put that in a task?

In the date filter?

An example would help... thanks



Yes, in the Date filter, if Modified date older than {DATE(WeekDayNumber|Friday)}
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
James Hagist
2020-07-17T17:57:41Z
Hmmm, I tried this.

image.png

But I am getting an error

Field 'Newer than' value is an invalid date. Try matching accepted Server format 7/7/2020 11:06 AM
thomas
2020-07-20T06:48:00Z
In my experience this is a bit tricky to solve in VC. Hopefully i'm wrong and somebody will correct me.

Fist of all, you are comparing a date against an int (day of week). That won't work. SomeDate < 6 doesn't make any sense
image.png

What could work, is if you found the actual date of the previous friday. You could add some .NET code that does this, for example:
image.png

This would run in a separate task, and return the date:
image.png

In theory you should be able to use this in the date filter like this (uncheck 'validate dates' before saving):
image.png

But it doesn't work for some reason. VC doesn't translate the variable into a date at runtime. The task doesn't actually fail, it will just ignore the filter. Instead if you hardcode exactly the same value it works.
image.png
Support
2020-07-20T12:05:01Z
Originally Posted by: thomas 

In my experience this is a bit tricky to solve in VC. Hopefully i'm wrong and somebody will correct me.

Fist of all, you are comparing a date against an int (day of week). That won't work. SomeDate < 6 doesn't make any sense
image.png

What could work, is if you found the actual date of the previous friday. You could add some .NET code that does this, for example:
image.png

This would run in a separate task, and return the date:
image.png

In theory you should be able to use this in the date filter like this (uncheck 'validate dates' before saving):
image.png

But it doesn't work for some reason. VC doesn't translate the variable into a date at runtime. The task doesn't actually fail, it will just ignore the filter. Instead if you hardcode exactly the same value it works.
image.png



Thanks for the information Thomas, you're right. I will bring it up with my colleagues and ask why the prevtask variable won't work in that case.
Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
bweston
2020-07-27T13:25:24Z
I don't have time to whip up a test to verify this right now, but I think I ran across this issue in the past and found that it didn't seem to be an issue of not expanding the variable, but rather of not recognizing it as a date. Wrapping it in a DATEADD of zero of some unit fixed it. I may be remembering the circumstances wrong, though.
Joey S
2020-07-28T22:33:52Z
I think you can still do it by using the Date tab and the < > option

What exactly are you trying to filter by? Are you looking for all files created before 'Last' Friday?

I think with more context we can advocate something that does not have additional steps or tasks.
bweston
2020-07-29T15:08:54Z
Originally Posted by: Joey S 

I think you can still do it by using the Date tab and the < > option

What exactly are you trying to filter by? Are you looking for all files created before 'Last' Friday?

I think with more context we can advocate something that does not have additional steps or tasks.



You're quite right. There is a formula for that, although if I'm remembering correctly, the simple form of it when used during the weekend will give you Friday before last. I can never remember on the first try how to adapt it to avoid that...okay, got it.

As demonstrated by changing the specified date in both places in

{DATEADD(Days|2020-07-03|yyyy-MM-dd|{MATH(Subtract|Integer|1|{DATE(WeekDayNumber|{DATEADD(Days|2020-07-03|yyyy-MM-dd|3|dddd)})}|)}|yyyy-MM-dd)}


it can be done with something like

{DATENOWADD(Days|{MATH(Subtract|Integer|1|{DATE(WeekDayNumber|{DATENOWADD(Days|3|dddd)})}|)}|yyyy-MM-dd)}



If you want it to give you last Friday when it is currently Friday, it gets slightly simpler; I think then this works:

{DATENOWADD(Days|-{DATE(WeekDayNumber|{DATENOWADD(Days|2|dddd)})}|yyyy-MM-dd)}


However, all that might be affected by the system regional settings for what is considered the first day of the week, depending on the internal implementation.

Here's another trick that does require an additional piece of setup but might be an improvement if the regional consideration is a concern, or if referring to an external entity will be less confusing than following the date math...set up a time exception for Friday (midnight exactly if you want checking it on Friday to get the current day, all day Friday if you want checking it on Friday to get the previous Friday) and use something like this:

{DATEADD(Days|{DATE(GetNextTimeException|<time exception collection id>|yyyy-MM-dd)}|yyyy-MM-dd|-7|yyyy-MM-dd)}


...okay I'll stop now
Scroll to Top