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


Guest
2012-01-26T11:34:00Z
Hello All,
I've created a job in order to download a file from FTP server trying to use Loop function to execute a smart Polling method, where wait for the file on FTP server, download it and exit from loop in case the variavle NoDownloadedFiles or NameDownloadedFiles contain is different of 0 or blank with the following Tasks:
1) FTP Trasport task - Download a file
2) Write File task - writing Log File
3) Renaming - rename the file downloaded
Loop Start at step (1) and ends at (2)
the Loop setting as been configured as following attempts:

*First attempt
While x
While = {TASK(PrevTask,Result.NoDownloadedFiles)}
data type: String
comparison method: Equal (=)
second value: 0
Sleep/Wait each iteration = 20 sec
*Result: Loop was executed 1 time if the file to download exists or not

*Second attempt
While x
While = {TASK(PrevTask,Result.NoDownloadedFiles)}
data type: String
comparison method: Equal (=)
second value: {USERVAR(ZeroStringVariable)} >>> User variable defined as String type and fix value = 0 (value Preview is 0)
Sleep/Wait each iteration = 20 sec
*Result: as the previus job result Loop was executed 1 time if the file to download exists or not

*Third attempt (into attached log file at 26/01/2012 12.05)
While x
While = {TASK(1c246d85-af60-4eb5-8748-6f1a2efbbcbb,Result.NoDownloadedFiles)}
data type: String
comparison method: Equal (=)
second value: {USERVAR(ZeroStringVariable)} >>> User variable defined as String type and fix value = 0 (value Preview is 0)
Sleep/Wait each iteration = 20 sec
max itations: 8
*Result: Loop was executed 8 times without exit at iteration 6 where the file was downloaded, it exit from loop ta end of maximum iteractions "Maximum number of loop iterations has been met."

Maybe I make a mistake on writing using variable into this functionality, does anyone can help me with this issue

thanks a lot
Ale
Sponsor
Forum information
Guest
2012-01-26T11:58:44Z
sorry, I missed this info: Visual Cron release is 6.0.6
Support
2012-01-26T21:20:13Z
I think it is hard so see what is wrong based on this. Regarding loops, we need simplicated, independent samples in order to reproduce something. My suggestion is that you create a new Job that does not have any dependency to any file. Something that we can test from here without having to prepare the environment too much.

If you really need to include the Variables in the test then export them too. Export just the settings needed to reproduce this.

Thank you.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
2012-01-30T08:47:54Z
Hello Henrik,
into attachment files you can find server settings exported, last server log and my personal log done by a Write task.
Into exported setting you could find the job "Loop Test based on variable NameDownloadFiles" all features you need. you can use the FTP server into connection and if you need can copy a file into that. Into the file WFDebugLoop.txt you can see the issue at interaction 4 where a file were downloaded but the job didn't exit from the loop.
I really hope you can help me...

thanks a lot
Support
2012-01-30T09:46:44Z
Thanks Alessandro,

I deleted the settings you uploaded (after downloading) because they contained Connection information which you might not want to share.

Anyway, the problem seems to be that you are trying to use the result of the first Task in the Loop. That is not possible.

A loop is checked _before_ a Task is being run. This means that the first time this Task is being run it has no result - and the loop will not Continue.

Maybe you could solve this by moving the first Task before the loop but then you might need to create Conditions later that jumps back to the Task. Either way I think it is hard to create this functionality using Tasks because an FTP Trigger is much more complex than that.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Guest
2012-02-15T08:42:07Z
Hello Henrik,
I solved my needs doing a smart polling on an FTP server with the following solution:
1)create a User defined variable as String
2)into the job I've created 3 step:
* (1)Initialize user variable to zero using function Set Variable
* (2)Define FTP transport task or task you wish
* (3)Valorize user variable to {TASK(1bb17713-36fb-442c-931d-6b979ee1b723,Result.NoDownloadedFiles)} or {TASK(PrevTask,Result.NoDownloadedFiles)} using funcion Set Variable
3)create a Loop "While X" from task (2) to task (3)
setting While "User Variable" + String + Equal(=) + 0
setting Sleep/Wait with waiting value you wish

when the job starts the download FTP will be repeated with a waiting time till it download a file; it'll change the variable exiting from loop.
that's all

I hope this can help anyone
Support
2012-02-15T08:44:16Z
Thanks for your input Alessandro!
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top