ssis expression - set a variable based on value of another variable

  • Hi all,

    I'm trying the following, but the syntax must not be correct since it errors. I'd like to set the value of @pNeedPorSessions to 6 if @FeedType is FullFile, else set to 1. Can anyone advise on the correct syntax?

    Thank you in advance!

    @[User::FeedType] == "FullFile" ? @[User::pNeedPorSessions] == 6 : @[User::pNeedPorSessions] == 1

  • What Data Type are the variables? If FeedType is not able to store string values or pNeedPorSessions is not configured for numeric values then you will get this error.

    If they are correct then are they in the correct Scope?

  • Hi,

    Feedtype is a string. pNeedPorSessions is an INT32. Both are in the same (main) scope. I tried using this expression in pNeedPorSessions.

  • When you say 'it errors'. I assume you mean the line of code is highlighted as an error once you leave it? Or are you getting an error when executing (and if so, what is the full error message)?

    If the syntax check is failing and highlighting the code, it is possible to see a description of the error in some of the expression editors by placing the mouse over the highlighted line, and a message box appears after a couple of seconds with a description of the problem. Do you see an error message if you try that?

  • your statement seems incorrect, find below corrected

    @[User::FeedType] == "FullFile" ? @[User::pNeedPorSessions] = 6 : @[User::pNeedPorSessions] = 1

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply