How to change the value of a variable within data flow

Hi,

I would like to know is there any way we can assign/change the value of variable within data flow without using script component

Thx.




Answer this question

How to change the value of a variable within data flow

  • PrashanthHebbar

    Row Count does that - but you are probably not looking for that specific case. Beside the script component you can only do it if you develop a sample data flow component.

    Why do you think the Script component is not a good option for you



  • 23

    Why do you think script component is slower Have you tested it

    Besides, in this case you shoudl only need to write to the variable once - during PostExecute(). You should not write to the variable when processing each row. That's very bad practice.

    -Jamie



  • MSP

    No, there is no faster altenative. The script cmponent is the only real way of doing this.

    One other way might be to give each row an ID and then join the data set to itself WHERE a.ID = b.ID - 1 AND a.x1 <> b.x1. Though it'll be difficult if you need to do it for 8 columns. Either way, it'll be slower than a script component.

    Believe me, use a script component!!

    -Jamie



  • Thomas N

    Hi Jamie,

    I have raised this question only because i feel that the script component in my job is slowing down the process.

    And it seems that, I have not mentioned my problem clearly. What I have to do is

    1. Read data from the source and consider it has a column x1.
    2. Compare the previous and current value of x1.
    3. If they are different increment the value of the variable y1 by 1. Otherwise keep the same value.
    4. Like column x1, I have 8 columns in that table as x1,x2,...x8. I have to do step 1 to 3 for all 8 columns. Also when x1 changes, regardless of x2 value, I need to increment the variable y2 by 1, y3 by 1.. y8 by 1. Same when x2, x3, ...x7 changes.

    One more thing is, I am not saying that 'script component' is slower compared to its alternative. What I am asking is, 'Is there any alternative to it which can be faster than script component '.

    Thanks all.



  • kimcat

    Hi,

    Thx for ur replies. What I want to do is, I want 2 compare the values of a field in 2 consecutive rows and whenever the value changes, I want to increment the value of a variable by 1. Though it is very simple to implement it in script component, I feel that it slows down the process. Since all other tools provides 'Expression editor' to edit the value of a variable, I feel that, if SSIS provides such a functionality, it would be faster.



  • MonktonCharlie

    Not unless you write a custom component.

    Why do you need to do this

    K



  • How to change the value of a variable within data flow