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


osirisja
2011-11-13T12:50:46Z
Hi Support

Pushing the boundaries with VC I have come across an 'issue' with the Write File task.

I am reading a 2 record text file with the Read File Task. The text file has a VC Variable coded in it as follows:

name=test job for reading vars from template
file={TASK(PrevTask,StdOut)}


After the Read File task reads this file, when I show the STDOUT from the task in the variables window, it shows (correctly):

name=test job for reading vars from template
file=\\10.20.40.71\Proout_DATA\@VC\log\template.txt


So you can see the record 'file={TASK(PrevTask,StdOut)}' has been changed correctly to 'file=\\10.20.40.71\Proout_DATA\@VC\log\template.txt' which I would expect.

Now when I write this Prevtask STDOUT to another file with the Write File task, the results are very strange. The file is being written with the contents as:

name=test job for reading vars from template
file=name=test job for reading vars from template
file=name=test job for reading vars from template
file=name=test job for reading vars from template
file=



So the First record is written out correctly, but then the next 4 records are re-writing the output from the first record - almost as if the First Record is becoming the STDOUT of the previous task. And why is it writing it 4 times (with the last one empty) when there are only 2 records in STDOUT from the previous task?

If I change the file I read so it doesn't use a variable but just a hardcoded file name, it works fine.

Am I expecting too much from the ability to translate variables from text files?

Cheers

Andy
Sponsor
Forum information
osirisja
2011-11-13T13:09:37Z
Update: Interestingly - If I set the file variable to a User Variable which has the PREVTASK STDOUT value assigned to it - e.g.:

name=test job for reading vars from template
file={USERVAR(Error_FileName)}



It works fine :-)

Seems like some kind of synchronisation issue with the task and the previous tasks STDOUT (or more likely, me being very silly!!!! 😂)

Cheers

Andy
Support
2011-11-14T08:07:33Z
So, did you resolve this?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-14T08:39:00Z
Hi Henrik

Well, I can use a variable to work around it so essentially I did solve it, but using {TASK(PrevTask,StdOut)} still produces strange results so it does look like a minor bug? Or........

Cheers

Andy
Support
2011-11-14T08:42:36Z
Could you please upload a simple sample of this?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-14T09:17:11Z
Hi Henrik

Exported example job and sample files attached. Folder structure is C:\test\templates

c:\test is the Trigger folder. Trigger file (trig.txt) is attached. Template file (template.txt - attached) goes in the Templates folder, and the re-written file 'templaterewrite.txt' is also written to the templates folder.

Cheers

Andy
File Attachment(s):
readtemplate_export.zip (3kb) downloaded 49 time(s).
template.txt (1kb) downloaded 49 time(s).
trig.txt (1kb) downloaded 49 time(s).
Support
2011-11-14T21:20:48Z
Not sure what you really want to do. 😁 But the reason of the output is that we try to translate a Variable in 3 levels. A Variable can contain 3 levels of sub variables. In your special case this might give a strange result because your are referring back to the Task output that is referring back to a Variable that is ref... etc.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-15T08:16:04Z
Hi Henrik

If the issue is explainable, and we know that the solution is to allocate variables that we wish to re-reference to User variables, then that is how we get around it, but I'm not sure what you mean by a variable can contain 3 levels of sub-variables?

Cheers

Andy
Support
2011-11-15T08:27:14Z
Originally Posted by: osirisja 

Hi Henrik

If the issue is explainable, and we know that the solution is to allocate variables that we wish to re-reference to User variables, then that is how we get around it, but I'm not sure what you mean by a variable can contain 3 levels of sub-variables?

Cheers

Andy



I mean that we are trying to resolve a Variable 3 times. For example, if we have a User Variable we resolve that, and then, if we find another Variable within that we resolve that and so on. Three times.

Currently I see no way of doing what you are trying to do.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
osirisja
2011-11-15T10:26:53Z
Hi Henrik

Okay - Well I know if I reassign the VC context variable to a user variable then it provides the functionality I am looking for.

Thanks for investigating this

Regards

Andy
Scroll to Top