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


daver555
2014-03-07T23:05:10Z
I'm having some trouble getting a hang of the VisualCron variables I need to use to do the following:

1. Get the right files using the File Filter. Example File name is 'R48 - Supplier Portfolio - 2014_03_07_135313.pdf'. Done!

2. Rename file to 'R48 - Supplier Portfolio - 2014-03-07.pdf'. Not done!

3. Move the report to the folder '\\server\Folders\Reports\Portfolio\2014\03'. Not done!

I'm having a hard time using variables in the Rename File task to parse the file name to get me the parts I need to create the new file mask.

Any help would be greatly appreciated!

Thanks in advance;

Daver
Sponsor
Forum information
Support
2014-03-07T23:59:14Z
2. Try using this text in the new name mask: R48 - Supplier Portfolio - {DATEFORMAT(yyyy-MM-dd)}.pdf

3. it depends how you find the file. Using a Trigger? Hard coded? What is the problem here?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
daver555
2014-03-10T23:47:16Z
Thanks Henrik! I'll give #2 a go tonight.

#3 is scheduled weekly. What I want to do here is move the files at the end of the week to their proper monthly folder. So at the end of the week, the file:

R48 - Supplier Portfolio - 2014-03-07.pdf

Should be moved to this folder:

\\server\Folders\Reports\Portfolio\2014\03

I need to read the year and month value in the file name in order to correctly file the report.

Cheers;

Dave
Support
2014-03-11T08:32:34Z
Originally Posted by: daver555 

Thanks Henrik! I'll give #2 a go tonight.

#3 is scheduled weekly. What I want to do here is move the files at the end of the week to their proper monthly folder. So at the end of the week, the file:

R48 - Supplier Portfolio - 2014-03-07.pdf

Should be moved to this folder:

\\server\Folders\Reports\Portfolio\2014\03

I need to read the year and month value in the file name in order to correctly file the report.

Cheers;

Dave



Isn't it easier if you move it right away, when it arrives, then you should know which folder to move it to (always current month). If so you can use a destination path like this:

\\server\Folders\Reports\Portfolio\{DATEFORMAT(yyyy)}\{DATEFORMAT(MM)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
2014-03-11T08:54:42Z
Hi Daver555,

I tried this with a file trigger, but you can change the file trigger variable with the right variable in your case.

So:

My last file trigger is:
{TRIGGER(Active|LastTrigger|File.Result.Name)} = R48 - Supplier Portfolio - 2014-03-07.pdf

Than you can strip the last 14 characters to get the last part:

{STRING(Right|{TRIGGER(Active|LastTrigger|File.Result.Name)}|14)} = 2014-03-07.pdf

Using this variable, it's easy to get the year and the month by using the substring method:

{STRING(Substring|{STRING(Right|{TRIGGER(Active|LastTrigger|File.Result.Name)}|14)}|0|4)} = 2014

{STRING(Substring|{STRING(Right|{TRIGGER(Active|LastTrigger|File.Result.Name)}|14)}|5|2)} = 03

So now you can use the file copy task and move the file to the right folder. Use the last two varaibles to create the right directories:

Portfolio\{STRING(Substring|{STRING(Right|{TRIGGER(Active|LastTrigger|File.Result.Name)}|14)}|0|4)}\{STRING(Substring|{STRING(Right|{TRIGGER(Active|LastTrigger|File.Result.Name)}|14)}|5|2)}


Regards
Erik
Uses Visualcron since 2006.
daver555
2014-03-11T22:42:48Z
That helped alot. I've worked out my issues.

I have one final question, is it possible to refer to other user defined variables within string functions? I tried to without any success and I was wondering if anyone else had any success or if that was just a limitation I wasn't aware of.

Finally, thanks to everyone for their help on this. My variable skills with VisualCron took a big +1 with your help.
ErikC
2014-03-13T13:54:21Z
Hi daver555,

Yes you can use User Defined variables just like other variables.
Create them first in th GUI and set a value there, or set the variable in a task.

{STRING(Right|put some text here|5)} = put s

Having an User Defined Variable called text with the 'put some text here' in there, you can use it like this:

{STRING(Right|{USERVAR(text)}|5)} = put s

So using a User Defined Variable is easy.

Regards
Erik
Uses Visualcron since 2006.
daver555
2014-03-17T17:52:12Z
Hi Erik,

Since I have your attention and you've been so helpful, maybe you can help me with this last task. I want to take the output of a Touch File Task and use it in the next Task to move some files. I've been using a variable with the following definition but I get an error. Obviously I'm not using the TASK(PrevTask,Name) functionality right so guidance here would also be a great help.

{STRING(Substring|{STRING(Right|{TASK(PrevTask|File.Result.Name)}|14)}|0|10)}

Cheers & Thanks Erik!

Dave
Scroll to Top