Increment Date within a file? - VisualCron - Forum

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


mrgooding
14 years ago
Hi There

I'm currently trying out visualcron, and am having trouble incrementing a date:

What I want to do is read a file, find the date, then add a day to the date.

I can see two separate functions that do this, but am having problems combining them:

{DATEADD(DAYS{FILE(Content|D:\Users\swtest01u.uk\Desktop\Test1.txt)}|ddMMyyyy|1|ddMMyyyy)}

Seems to bring up an error.

I also need to know how to either Parse the file to find the date, or (preferably) be able to tell visualcron that the date is on line 7, from characters 7 to 14.

Any help would be greatly appreciated.

Kind regards,

James

Sponsor
Forum information
Support
14 years ago
Only way to do that right now is to use the Regex method to find line 7 or the string the "looks" like a date. I am no expert on regex but there are a lot of forums for that.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mrgooding
14 years ago
Thanks Henrik - best read up on regex then!

Kind regards,

James
mrgooding
14 years ago
Hi Henrik

I've had a read up on regex, and been able to implement this, but it only works for one or two iterations. What i've done is:

1. Read a file, using regex the date in the file:

{REGEX(Match|{FILE(Content|D:\Users\swtest01u.uk\Desktop\1\test1.txt)}|^(0[1-9]|[12][0-9]|3[01])(0[1-9]|1[012])(19|20)\d\d$)}

2. Replace using the dateadd function (referencing part 1's task).

{DATEADD(Days|{TASK(dc720fe1-6cbf-4523-8519-8c21ca93120d,StdOut)}||ddMMyyyy|1|ddMMyyyy)}

All the file contains is 19042011, which when run once, correctly changes to 20042011. Running it again comes up with the following error:

{DATEADD(Days|"[Error in SetVariables, string: {DATEADD(Days|"[Error in SetVariables, string: {DATEADD(Days|"[Error in SetVariables, string: {DATEADD(Days|"[Error in SetVariables, string: {DATEADD(Days||ddMMyyyy|1|ddMMyyyy)}, err: String was not recognized as a valid DateTime.]"

Any ideas where this could be going wrong?

James
Support
14 years ago
The Variable should look more like this:

{DATENOWADD(Days|{TASK(dc720fe1-6cbf-4523-8519-8c21ca93120d,StdOut)}|yyyy-MM-dd HH:mm)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top