Reputation: 75
I have a flat file with the following columns
SampleID Rep_Number Product Protein Fat Solids
In the flat file SampleID and Product are populated in the first row only, rest of the rows only have values for Rep_Number, Protein, Fat, Solids. SampleID and Product are blank for the rest of the rows. So my task is to fill those blank rows with the first row that has the sampleID and Product and load into the table.
So task is to pick the first non null SampleID and Product from the flat file and put them in a variable. And rest is all configured. If I can pick the first non null SampleID and Product directly from the flat file and put into their respective variables I can take it from there. That is all I need.
I can connect a script component to flat file source in a data flow task. I need help with the script to pick the first non null values (SampleID and Product),
Need help please. Thanks in advance.
Upvotes: 0
Views: 492
Reputation: 36
If you are sure you need to store the data of the 1st row - 1st 2 columns' values in variables and take it from there, and DO NOT REQUIRE a change in your original approach, then try this:
Under the Public Overrides Sub PostExecute() {} procedure type this:
If Variables.Row_Count = 0 Then
Variables.Your_Variable1 = Row.Column_Name1
Variables.Your_Variable2 = Row.Column_Name2
Variables.Row_Count= Variables.Row_Count + 1
End If
You have the desired values in your variables, proceed with the rest of your logic.
Note:
Please mark my post as answer if it helps :)
Upvotes: 1