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


Markus Baer
2023-03-29T11:40:42Z
Hi there,

I am working on a job that loops through multiple files (using the for each property with the result of a list file task) and depending on a part of the file name either moves the file to a specific folder or unzipps it.

Therefore, I created a condition that evaluates a job variable in order to determine which action to take.

If the variable equals "NA" it should execute the move/copy file task. If it does not it should go to the next task which extracts the current zip file.

However, the job looses the loop variable {LOOP(CurrentValueX)} (which contains the current filename) after the condition is evaluated if the variable does not equal "NA".

Moreover, the loop stops even though not all files have been itterated. I also enabled "Extended debug logging" on the condition but can not see anything in the job log how the condition is evaluated.

Does anybody have an idea why this is the case?

Thanks and best regards,
Markus
Sponsor
Forum information
2024-10-09T22:36:45Z
I know this is an older post, but we were experiencing a similar issue in version 11.2.2 and I thought I'd post what we found so that it might help others with the same issue. This seems like a bug to me, but maybe there is some explanation as to why it works this way.

When initializing a loop, we were using the "PrevTask" variable to reference the Task that was retrieving the list of values to loop over. This worked in earlier versions before we upgraded and this method was preferred because we often clone jobs, so the fewer explicit Variable Id's we need to update when doing so the better.

PROBLEM:
For Each Row X in: {TASK(PrevTask|StdOut)}

While this worked in most instances, we experienced issues anytime a Task within the loop had a Condition tied to it that was not met. At this point, the Action "On Match None > Next" would get triggered and the variable that was initialized for the For..Each loop would get completely wiped out. This meant that once the loop completed, it would no longer contain the values needed for its next iteration over the value list that was originally set because it no longer existed.

The fix was to completely avoid using the "PrevTask" variable in the For..Each loop initialization, and instead, explicitly reference the Task Id for the Task responsible for retrieving the list of items to loop over (Ex. List Files In Directory).

FIX:
For Each Row X in: {TASK(faa28d28-9902-4e66-afc2-8deee479e471|StdOut)}

Hope this helps someone else in need of an answer.

thomas
2024-10-10T10:33:13Z
Thanks, that's nice to know. Pretty nasty bug
Scroll to Top