Showing posts with label destination. Show all posts
Showing posts with label destination. Show all posts

Monday, March 19, 2012

add total row to file via script component

Hi, I have a flat file source going into a script component which manipulates some values and puts those values in a flat file destination. What I now need to do is total a column within the script component and add that value as a row to the destination. At the moment data from source looks something like

ABC, 3

DEF, 5

FGH, 6

I have a variable in script component holding the running total I now want to add that to destination as a row e.g.

ABC, 3

DEF, 5

FGH, 6

Total, 14

This is probably very easy but I don't now how to add the Total row via the component. At the moment all rows are manipulated in the ProcessInputRow sub of component and output column values are assigned here. How do I add the Total row as I need to do this once last input row is complete.

Thanks

You'll need to use an asynchronous output to accomplish this. You could add an async output in addition to the synchronous output you get by default, and just write the running total to it.

See this topic in Books Online:

"Creating an Asynchronous Transformation with the Script Component"

|||You could also just use a multicast and an Aggregate transform to accomplish the same thing.|||Great thanks, Asynchronous Transformation worked

add total row to file via script component

Hi, I have a flat file source going into a script component which manipulates some values and puts those values in a flat file destination. What I now need to do is total a column within the script component and add that value as a row to the destination. At the moment data from source looks something like

ABC, 3

DEF, 5

FGH, 6

I have a variable in script component holding the running total I now want to add that to destination as a row e.g.

ABC, 3

DEF, 5

FGH, 6

Total, 14

This is probably very easy but I don't now how to add the Total row via the component. At the moment all rows are manipulated in the ProcessInputRow sub of component and output column values are assigned here. How do I add the Total row as I need to do this once last input row is complete.

Thanks

You'll need to use an asynchronous output to accomplish this. You could add an async output in addition to the synchronous output you get by default, and just write the running total to it.

See this topic in Books Online:

"Creating an Asynchronous Transformation with the Script Component"

|||You could also just use a multicast and an Aggregate transform to accomplish the same thing.|||Great thanks, Asynchronous Transformation worked

add text to a column

Hi,
I am mapping the .csv files to a destination table in sql server.
The names of each column in the .csv file is the same as the ones in the destination table.
In the destination table there is an extra field i.e. FileTypeField

Here is the question;
When transfering the data from .csv to the destination table i.e flat file source to oledb destination, I would like to place a text into the field FileTypeField
I do not see an option to do this. Can you help please?
Thanks

Use a derived column transformation to add a column to the data flow. Then you'll just map that new column to the destination table.|||Thanks

Monday, February 13, 2012

ADD A COLUMN AND POPULATE IT WITH A SINGLE VALUE FROM A USER VARIABLE

Hi !

I have one Excel source with ... say 2 columns, I have an SQL Server destination with 3 columns.

I want the third column to be populated with a single value stored in a User::Variable.

Can someone help !

Jacques...

Just add a Derived Column transformation and assign your User::Variable to the derived column.

That's it.

|||

Thanks Sbastien !

Jacques