I have a Script Component where I buffer all the rows, then do some processing, and then I want to create the output rows. I tried accessing the Output Buffer object in PostExecute but apparently that's not possible? Gives "Object Reference not set to an instance of an object" error when it hits AddRow(). Is there a way to do this?
public override void PostExecute()
{
base.PostExecute();
//processing
foreach(ChartValue cv in chartValues)
{
Output0Buffer.AddRow();
Output0Buffer.usedcl = cv.Centerline;
//etc
}
}
The answer is no, you can't do that but easy solution: add the ProcessInput function to loop through each row using the ProcessInputRow function (the function that is already included) and use EndOfRowset to know when you are done, then you can do the final processing code.
public override void Input0_ProcessInput(Input0Buffer Buffer)
{
base.Input0_ProcessInput(Buffer);
try
{
//loop through each row
while (Buffer.NextRow())
{
Input0_ProcessInputRow(Buffer);
}
//when done collecting all rows, do calculations
if (Buffer.EndOfRowset())
{
CalculateResults();
}
}
catch (Exception e)
{
//code here
}
}
public override void Input0_ProcessInputRow(Input0Buffer Row)
{
//gather each row's values and put into List for processing at the end