Friday, February 24, 2012

For Loop Container does not check condition first time

Hi,
It seems like For Loop Container works like do-while loop in C++. I have set its EvalExpresstion to @.[User::SyncStats]==0 , I have an Execute SQL Task before this container that sets the variable to 1 but Container still executes atleast one time.

Anybody else been through this ?Curious, what happens when you set the For Loop's DelayValidation = True?|||

Phil Brammer wrote:

Curious, what happens when you set the For Loop's DelayValidation = True?


Same behavior|||Do you have anything in InitExpression?

What happens if you set the User::SyncStatus variable to 0 in the variables window and then try to run it?|||Well, There is an Execute SQL Task before the container which is responsible for initializing value on the basis of the return value from Stored Procedure.

For just the curiosity, Yes it works if I set the value in InitExpression. But I want it to use the value set by prior task.|||Well,
Silly me,

There were actually 2 variables of same name but one with Loop Container scope one with global scope.

And I wanted Loop Container to check the Global one. I changed the namespace and it works

Thanks anyways.

No comments:

Post a Comment