You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Categories
- Business Objects (3)
- Best Practices (2)
- Fusion Charts (5)
- Main (3)
- SQL Server (1)
- SSIS (1)
- Uncategorized (1)
- Universe Design (3)
- Web Intelligence (4)
- Xcelsius (12)
- Design Practices (3)
- Excel (2)
- Tips and Tricks (4)
- Workarounds (1)
Archives
- July 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- October 2009
- August 2009
- April 2009
- March 2009
- January 2009
- December 2008
- November 2008
- October 2008
Tag Cloud
auto increment
best practices
bonavista
bulletgraph
Business Objects
charting
charting package
conditional formatting
content management
dashboard
datatable
dianne sawyer
dom
Excel
expand
fannie mae
fix
flash charts
fred carter
frederick carter
free
Fusion Charts
grid component
imt slider
inovista
java
javascript
Java Wrapper
microcharts
pathway technologies
populate dimension table
ripoff
scam
sorting
sparkline
SSIS
table
tree grid
universe
User Access
User Management
Web Intelligence
wrapper
Xcelsius
Xcelsius 2008
Latest Tweets
-
Using Filtered rows instead of VLOOKUPS in Xcelsius @
http://davidlai101.com/blog/2010/07/02/using-filtered-rows-instead-of-vlookup/ - posted on Jul 03, 2010
-
New Post on the Xcelsius Push Button Object @
http://davidlai101.com/blog/2010/05/29/xcelsius-push-button/ - posted on May 29, 2010
-
Xcelsius dynamic color binding article and video posted @ http://davidlai101.com/blog/2010/04/06/xcelsius-dynamic-color-binding/ - posted on Apr 06, 2010
-
New post on Xcelsius Canvas Containers @ http://davidlai101.com/blog/2010/03/26/xcelsius-canvas-container/ - posted on Mar 26, 2010
-
Guide on Business Objects access levels posted http://davidlai101.com/blog/2010/02/19/understanding-business-objects-access-levels/ - posted on Feb 19, 2010


Auto Incrementing a dimension primary key in SSIS
While working with SSIS to generate star schemas, a common problem I faced was populating a dimension table from another table that did not contain any ids for the items being inserted. If you would try to insert the dimension data without any keys, an error would be thrown since the id field cannot be null.
An easy solution is to have a script populate the id column.
In this example we take a table that does not have any ids related to the dimension that we want to populate. First we aggregate the items that we want inserted into the dimension.
Next we will need to create another column that contains the id column. The column must have an incremented value for each row. In order to do that we must use a script component. Go to the toolbox and select Script Component. Then select Transformation from the Select Component Type menu.
You will have a list of input columns that you can choose from. Choose all of them. Next click on the Inputs and Outputs selection on the left menu. On the output portion click on Add Column Name your output column accordingly and take note of the name since you will need to use it after. In this example I named mine “Row”.
Next select Script from the left side and then click on the Design Script button above the OK and Cancel buttons. Copy and paste the following code and save the script.
Public Class ScriptMain
Inherits UserComponent
'Declare a variable scoped to class ScriptMain
Dim counter As Integer
Public Sub New() ' This method gets called only once per execution
'Initialise the variable
counter = 0
End Sub
'This method gets called for each row in the InputBuffer
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Increment the variable
'
counter += 1
' Output the value of the variable
Row.Row = counter
End Sub
Please take note that the Row variable must be your output name.