Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Read and Write the same variable in a DFT script component


Read and Write the same variable in a DFT script component

Author
Message
Paul Hernández
Paul Hernández
SSC-Enthusiastic
SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)SSC-Enthusiastic (171 reputation)

Group: General Forum Members
Points: 171 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()
{
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search