Does variable value set by Row Count Transformation take effect during execution of DFT in SSIS? or Conditional Split can read a variable correctly?

Pritesh picture Pritesh · Mar 13, 2013 · Viewed 11.1k times · Source

I have a SSIS package where1 record (hard coded) flow through.

enter image description here

I have variable in DFT scope.

enter image description here

I assign value to variable using Row Count Transaformation.

enter image description here

The value should be 1 i verify it by using script component.

 public override void PostExecute()
  {
    System.Windows.Forms.MessageBox.Show(ReadWriteVariables[0].Value.ToString());
    base.PostExecute();
    /*
      Add your code here for postprocessing or remove if not needed
      You can set read/write variables here, for example:
      Variables.MyIntVar = 100
    */
  }

I look for zero condition through condition in Conditional split transformation.

enter image description here

Strangely it satisfies equal to zero condition whrease I think it should have value 1. Even Messagebox through script component shows value 1.

enter image description here

what could be the reason? Are value in varible realize only towards end of DFT or Conditional Split has some problem reading correct value or something else which i am not able to think up?

Answer

praveen picture praveen · Mar 13, 2013

The value for variable being assigned inside a data flow task can't be used in the split transformation or later in the Data Flow task . The values generally get populated once DFT gets completed .

Variable values does not update during the execution of Data Flow task 

Even though you are able to see value 1 or set some other value to Variable from script transformation in post or pre execution events ,these values gets effected only after the execution of DFT

Hence the updated value can be used in precedence constraint or other tasks in control flow .

Read this article .