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


mdawson
2014-02-26T18:54:22Z
I'm building a job that loops a list of records like below from a console app StdOut. This is to replace a old process that zips up kinds of files by month using file modified date, to the appropriate zip name and archive folder.

The record is zip-file-name|folder-to-zip|mask to include|base-date.

The loop works until I try to have it evaluate a date expression to limit the files included in the archive. I would like to use the date in the record to set a calendar month range, but I get an "invalid date" error on these expressions in the dialog. Any suggestions? If not possible currently, I would like this capability added.

Job variable BASEDATE = {LOOP(CurrentValueXArray,3)}

newer than: {JOB(Active,Variable,BASEDATE)}
older than: {DATEADD(Months|{JOB(Active,Variable,BASEDATE)}|M/d/yyyy|1|M/d/yyyy)}

Records look like this. Replace "logs" with other kinds of files, like reports.

\\server\BKUP\logs\jobcode_logs_201307.zip|\\server2\jobs\jobcode\logs|*.*|07/01/2013 12:00 AM
\\server\BKUP\logs\jobcode_logs_201308.zip|\\server2\jobs\jobcode\logs|*.*|08/01/2013 12:00 AM
\\server\BKUP\logs\jobcode_logs_201309.zip|\\server2\jobs\jobcode\logs|*.*|09/01/2013 12:00 AM
\\server\BKUP\logs\jobcode_logs_201310.zip|\\server2\jobs\jobcode\logs|*.*|10/01/2013 12:00 AM
\\server\BKUP\logs\jobcode_logs_201311.zip|\\server2\jobs\jobcode\logs|*.*|11/01/2013 12:00 AM
Sponsor
Forum information
Support
2014-02-26T22:22:24Z
I do not see how you define BASEDATE. Are you using a Set Variable Task? Also, you seem to use a Job Variable but only User Variables can be set with Set Variable Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-27T14:21:00Z
BASEDATE is a job variable set to {LOOP(CurrentValueXArray,3)}, the date column. It seems that since the loop is not active when I set up the task that uses the variable, it doesn't evaluate to a date value. I use this in other places, but it looks like I can't in a date field.
Support
2014-02-27T14:38:47Z
But how do you set BASEDATE?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-27T15:26:26Z
VC evaluates it inside the loop.
Support
2014-02-27T16:10:47Z
Originally Posted by: mdawson 

VC evaluates it inside the loop.



There is no other way to set a Job Variable than manually when editing the Job so I do not understand how you assign it?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-27T17:35:10Z
When I do loops on lists like csv records or file lists, I set up job variables for the columns of interest.

In this job, job variable BASEDATE is defined as {LOOP(CurrentValueXArray,3)}. When the job executes, VC evaluates {LOOP(CurrentValueXArray,3)} on each loop iteration and the result is stored in BASEDATE, ie 07/01/2013 12:00 AM for the first iteration and so on. When a task (or other variable) inside the loop accesses BASEDATE, it's value is from the current loop/record. This also works when combined variables.

I have an example job to illustrate...is there a way to send it to you?
Support
2014-02-27T17:48:15Z
Yes, please send it to support@visualcron.com
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-27T18:00:23Z
Support
2014-02-27T21:28:55Z
I believe there is a misunderstanding on how Variables works. In the Read file Task you are referring to a Job Variable: {JOB(Active,Variable,INPUTFILE)}

That Job Variable contains {LOOP(CurrentValueXArray,0)}. There is really no point in referring to the Job Variable when you can refer to {LOOP(CurrentValueXArray,0)} directly. You are not setting any Variable this way, you are just saying that the Job Variable should reference to that current Variable.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-02-27T22:46:19Z
Yes, my original test looping job that I sent you uses one unnecessary job variable, to test whether VC updates job variables on each loop, and to show you how I'm using the variables in the job at the top of this post. Most of my looping jobs though loop data with several columns over several tasks, so using job variables works perfectly for maintenance.

So, I was looking to use the data's date column to filter files for the zip task on each loop. I found that I'm not able to use a loop variable in the dialog date fields like I can for folders, masks and other dialog fields because it tries to validate the date type immediately, but all it sees is the loop expression. As I said, if there's not some other approach for data-driven file filtering, then I'd like to see this capability implemented somehow in a future release.

Support
2014-03-11T08:43:15Z
I am not sure if you got your answer here. But in short we do not update any Job Variables that way you do it. You can update User Variables with the Set Variable Task.

If you want to pick the value for a specific column you are using the right Variable but probably you do not split on the right characters (in loop settings).
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
mdawson
2014-03-12T15:21:42Z
Job variables that reference a loop expression do update inside a loop perfectly. But I see now that only Date and User variables are the only options for the dialog date fields.

My problem with the Set Variable Task is that it creates a globally visible variable. My first thought is the danger of other jobs possibly setting a variable of the same name, and the "human" management required to prevent that. That is too risky for our environment and dealing with HIPAA and client data. I may have to work out something else outside of VC for this archive task.

What would be perfect is if 1.) Set Variable Task would work on a job variable, 2.) the dialog's date fields would accept job variables (initialized with arbitrary dates), 3.) I update the job variables inside a loop via Set Variable Task to a value such as {LOOP(CurrentValueXArray,3)} before the archive task executes.

So, my two feature requests are: Set Variable Task can update job variables (including from loop expressions), and date fields in the various file dialogs can take a job variable.
Support
2014-03-12T21:09:21Z
Which date fields are you thinking about?

I am moving this topic to Feature requests and changing the title a bit.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top