[Solved] Question on Loop - 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.


Necronomecon
10 years ago
Dear all,

I have a question regarding the loop functionality.

I have a list abc.txt with an undefined number of list entries, e.g. 3 entries for the example
abc.txt
ZZZZ9345
Z0200201
Z030DFGS

I want Visual Cron to go through this list line by line and upload files with identical names which are stored on a share via SFTP to an external party.
This is what I've tried:
1. I created an upload task pointing to the share mentioned with the "Include file mask" {LOOP(CurrentValueXArray,0)}. ( I also tried {LOOP(CurrentValueX)} and {LOOP(CurrentValueXLine)} )
2. I created a loop on this task"For each x in y" and {FILE(Content|D:\abc.txt)}. When I open the "Variable Browser" and insert this line, I can see the three lines of abc.txt

However, when I execute the task, no files will be uploaded to the external party? Could someone please tell me what I'm doing wrong?
I already watched the video on YouTube https://www.youtube.com/watch?v=hSPLLvBU2Ts  which explains loops as well as tried to find a solution in the forum, but I didn't find one. From my point of view the video tutorial deals with the same topic.

Any suggestions?

Thank you in advance and have a good weekend!
Sponsor
Forum information
Support
10 years ago
It is maybe you you have split the file list. Open the Loop settings and add a screenshot here.

You can also try, to simplify, instead of upload, just write the value to a file. Then you will see exactly which value is used at that moment.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Necronomecon
10 years ago
11-21-15_Add Task Loop.jpg

When I try to write the output in a TXT file, I get this result:
[Current context (running Task) is not in a loop]
Support
10 years ago
Look at the main settings of the Loop. Perhaps you are not covering that Task.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Necronomecon
10 years ago
I added both pictures of the main settings.
First one is the test job containing write to file. Second one is the job I want to implement
12-17-27_Add Task Loop.jpg
12-17-15_Add Task Loop.jpg

BTW: Is it possible to get remote support on this topic? We have a valid maintenance contract as far as I know.
Support
10 years ago
We would really like to save time by solving it here first.

1. Use a local path to the file that you read to make sure it can be read by the server
2. I see you are using Tab(?) as new line - is that really true for the file?
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Necronomecon
10 years ago
1. I switched to local path, but same result: [Current context (running Task) is not in a loop].
2. I was using Tab because I was playing around with the settings.

Screenshots of the Test-Task that you don't get confused. Let's try to write in the test file first.
12-49-55_Variables.jpg 12-50-03_Add Task Loop.jpg 12-17-27_Add Task Loop.jpg 12-54-27_AddEdit Task - Write file - 1010.jpg
Support
10 years ago
I made a quick example of exactly what you are doing. Please compare it with what you do to see what you are doing differently:

http://screencast.com/t/HwbDFrqibk 
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Necronomecon
10 years ago
Thank you for your tutorial. That's exactly what I did. When I run the job itself, output is written to the output file. When I run the single task, I get [Current context (running Task) is not in a loop] :-)

I didn't know that I need to run the job and cannot run a single task.
Support
10 years ago
Originally Posted by: Necronomecon 

Thank you for your tutorial. That's exactly what I did. When I run the job itself, output is written to the output file. When I run the single task, I get [Current context (running Task) is not in a loop] :-)

I didn't know that I need to run the job and cannot run a single task.



Yes, the reason is that Loops are part of a Job rather than Task.

Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Necronomecon
10 years ago
two further questions regarding the upload of files.

1. how to specify wildcards within the for each loop as the list file is named SivantosPic_DDMMYYYY?
I tried {FILE(Content|D:\01_Data\Areva\SivantosPic*)} but doesn't work => [File D:\01_Data\Areva\SivantosPic* does not exist]

2. how to specify wildcards within the Loop file mask as the files to upload are named like this: ZXXXXXX_XXXXX_XXXX.jpg
I tried {LOOP(CurrentValueX)_*.jpg} but didn't work. I think I have to concatenate somehow the Loop variable with a string variable, but to be honest I didn't get the clue of the variables so far

I would be very happy if you can help with this issue.

Thanks in advance!

Necronomecon
10 years ago
already solved my first question => {FILE(Content|D:\01_Data\Areva\SivantosPic_{DATEFORMAT(ddMMyyyy)})}
thomas
10 years ago
Try putting the filextension outside the bracket, something like this: {LOOP(CurrentValueX)}.jpg
Necronomecon
10 years ago
Easy solution 🙂 Thanks brother!!! You made it!

Have a good day!
Scroll to Top