If COL01 == "1" ? COL02 = "44"

  • How to implement this kind of logic

    using Derived Column task:

    If COL01 == "1" ? COL02 = "4"

    I try this expression and it's red.

    Syntax error or maybe Derived Column is not designed to do this kind of things?

  • Solution:

    Derived Column: COL02

    Expression:

    If COL01 == "1" ? "4" : "whatever"

    Looks like you need a derived column.

    You can not replace the existing column values using Derived Column Expression.

  • Sounds to me that you might want to investigate the conditional split options whic may give you the flexibility you need. In other words - split the process into two based on your Col1=1 condition, and then set up different derived column calculations below the split based on whatever is appropriate.

    Can't say I've used something quite like that, but I can't think why that sequence wouldn't work.

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Hi Matt,

    It's a pretty simple task so I wouldn't split my data flow

    to implement this.

    Derived column is good enough.

    I also found out that you can do it in Data Flow Script Component:

    If Row.COL01 = "1" Then

    Row.COL02 = "2"

    Else

    Row.COL02 = "3"

    End If

    But the easier it is the better so I stick with Derived Column solution.

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

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