Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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
Author
Message
Posted Wednesday, December 12, 2012 2:53 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, December 10, 2014 4:38 AM
Points: 120, Visits: 491
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()
{
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
*/
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)
{
Counter++;
}
else {
Counter = 0;
}
Row.Position = Counter;


}

Any comment would be appreciated.

Kind Regards



Paul Hernández
http://hernandezpaul.wordpress.com/
https://twitter.com/paul_eng
Post #1395531
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse