February 8, 2011 at 9:34 am
I've got a script component doing a transform on a data set straight out of SQL. But when it gets to the script step it starts filling up my hard drive (got around 6gb free to start with).
Aside from the fact that what I'm trying to accomplish could probably be done with a tsql COALESCE, why is my hard drive filling up? The data set is only 37k records (includes a ntext field).
Here's the code.
public class ScriptMain : UserComponent
{
private long rowItemID;
private string notes;
private bool firstRow = true;
public override void NotesInput_ProcessInputRow(NotesInputBuffer Row)
{
if (Row.itemid == rowItemID)
{
notes += "\r\r[" + Row.firstname + " " + Row.lastname + " - " + Row.datesubmitted.ToString() + "]\r\r" + Row.thenote;
}
else
{
if (firstRow)
{
firstRow = false;
}
else
{
NotesOutputBuffer.AddRow();
NotesOutputBuffer.issueID = rowItemID;
NotesOutputBuffer.workDescription.AddBlobData(System.Text.Encoding.Unicode.GetBytes(notes));
}
rowItemID = Row.itemid;
notes += "[" + Row.firstname + " " + Row.lastname + " - " + Row.datesubmitted.ToString() + "]\r\r" + Row.thenote;
}
}
public override void NotesInput_ProcessInput(NotesInputBuffer Buffer)
{
base.NotesInput_ProcessInput(Buffer);
if (Buffer.EndOfRowset())
{
NotesOutputBuffer.AddRow();
NotesOutputBuffer.issueID = rowItemID;
NotesOutputBuffer.workDescription.AddBlobData(System.Text.Encoding.Unicode.GetBytes(notes));
NotesOutputBuffer.SetEndOfRowset();
}
}
}
February 8, 2011 at 3:05 pm
Ok. so after spending a day on this, I realized my second "notes += ..." should have been "notes = ...". So that variable kept building even after a new itemID was hit. Plus I realized I was handling the reading of the ntext field all wrong (should have been GetBlobData().
All is good now.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply