Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Read and Write the same variable in a DFT script component Expand / Collapse
Posted Wednesday, December 12, 2012 2:53 AM



Group: General Forum Members
Last Login: Friday, November 4, 2016 4:42 AM
Points: 165, Visits: 654
Hi guys,

It would be nice if you could help me with the following issue:

I need to read a DFT level variable in a script component (set as transformation). Depending on its value make some calculation and then update its value again. That's should be made for every incomming row. The problem that I´ve encountered is I tried to read the variable in the row processing method and write it in the postexecute() method. I got this error "The collection of variables locked for read and write access is not available outside of PostExecute." But I really need the value of the variable in the main method.
Below is my code

public override void PostExecute()
Add your code here for postprocessing or remove if not needed
You can set read/write variables here, for example:
Variables.MyIntVar = 100
Variables.receiptKey = newReceipt;


public override void Input0_ProcessInputRow(Input0Buffer Row)
Add your code here
//currentReceipt = Row.BelegKey;
currentReceipt = Variables.receiptKey;
newReceipt = Row.TransactionExtId;

MessageBox.Show("The stored receipt key is: " + currentReceipt.ToString() + " The new is: " + newReceipt.ToString());
if ( currentReceipt == newReceipt)
else {
Counter = 0;
Row.Position = Counter;


Any comment would be appreciated.

Kind Regards

Paul Hernández
Post #1395531
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse