Monday, March 12, 2012

Expressions in For Loop Container

Hi,
I am having problem when setting for-each container's EvalExpression as a variable comparison.

I have set this in expression editor
@.[User::Syn] == 1

Editor says that it couldnt convert from System.Bool to System.String.

If I put it in quote, then for-each container says that it needs Bool, not String.

Please help me with this,
Thanks
@.[User::Syn] == "1"|||Syn is of Int32 datatype.
And now it says

Expression cannot be evaluated.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2005&ProdVer=8.0.50727.42&EvtSrc=Microsoft.DataTransformationServices.Controls.TaskUIFramework.TaskUIFrameworkSR&EvtID=FailToEvaluateExpression&LinkId=20476

The data types "DT_I4" and "DT_WSTR" are incompatible for binary operator "==". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator.

Attempt to set the result type of binary operation "@.[User::SyncStatus] == "0"" failed with error code 0xC0047080.

(Microsoft.DataTransformationServices.Controls)|||actually, EvalExpression property is string and expression editor must end up with some string value and something == something is basically a boolean.|||So is it User::Syn or User::SyncStatus? If SyncStatus is a DT_I4, then this should work:

@.[User::SyncStatus] == 0

It works for me.|||

Fahad349 wrote:

actually, EvalExpression property is string and expression editor must end up with some string value andsomething == something is basically a boolean.

EvalExpression "must evaluate to a Boolean"|||

Fahad349 wrote:

actually, EvalExpression property is string and expression editor must end up with some string value andsomething == something is basically a boolean.

Why aren't you using the EvalExpression in the editor, not the expression property?

If you are editing the property expressions, then this is what you'd want:

"@.[User::SyncStatus] == 0"

No comments:

Post a Comment