Custom Sorting using Microsoft.AnalysisServices to generate an OLAP Cube
up vote
0
down vote
favorite
In this project we are dynamically creating a multidimensional cube via Microsoft.AnalysisServices in VB.NET. This code has been used for a few years and now we need to make a modification.
We add a fact table with a field D1.
We then add an assortment of master tables, including D1 and the relationships. So we programatically adding relations for D1 with something like:
DataSourceView.Schema.Relations.Add(pkColumn, fkColumn)
We the add the dimension D1 and define the Key/Name:
Private Function GenerateAttributeDimensionGeneric(ByVal objDatabase As Database, ByVal objDataSourceView As DataSourceView) As Object
Dim objDimension As New Dimension()
objDimension = objDatabase.Dimensions.Add("D1")
objDimension.Source = New DataSourceViewBinding(objDataSourceView.ID)
Dim objDimensionAttributesColl As DimensionAttributeCollection = objDimension.Attributes
Dim objAttribute As DimensionAttribute = objDimensionAttributesColl.Add("D1_PK")
objAttribute.Usage = AttributeUsage.Key
objAttribute.KeyColumns.Add("D1", "D1_PK", OleDbType.[Integer])
objAttribute.NameColumn = New DataItem("D1", "AttributeValueName")
This works dandy. Now we are being requested to add custom sorting options on D1. So we added a new field (iOrder) to the schema and changed the import to include this for the D1 table.
When adding the Dimension D1 using the code snippet above, I'm trying to tell it to use iOrder.
objAttribute.AttributeRelationships.Add("iOrder")
objAttribute.OrderBy = OrderBy.AttributeName
objAttribute.OrderByAttribute.Name = "iOrder"
after the last row I'm getting an error.
Object reference not set to an instance of an object.
Anyone have thoughts or examples of custom ordering USING C#/VB.NET? was utilizing this to get me this far.
.net vb.net ssas olap ssas-2012
add a comment |
up vote
0
down vote
favorite
In this project we are dynamically creating a multidimensional cube via Microsoft.AnalysisServices in VB.NET. This code has been used for a few years and now we need to make a modification.
We add a fact table with a field D1.
We then add an assortment of master tables, including D1 and the relationships. So we programatically adding relations for D1 with something like:
DataSourceView.Schema.Relations.Add(pkColumn, fkColumn)
We the add the dimension D1 and define the Key/Name:
Private Function GenerateAttributeDimensionGeneric(ByVal objDatabase As Database, ByVal objDataSourceView As DataSourceView) As Object
Dim objDimension As New Dimension()
objDimension = objDatabase.Dimensions.Add("D1")
objDimension.Source = New DataSourceViewBinding(objDataSourceView.ID)
Dim objDimensionAttributesColl As DimensionAttributeCollection = objDimension.Attributes
Dim objAttribute As DimensionAttribute = objDimensionAttributesColl.Add("D1_PK")
objAttribute.Usage = AttributeUsage.Key
objAttribute.KeyColumns.Add("D1", "D1_PK", OleDbType.[Integer])
objAttribute.NameColumn = New DataItem("D1", "AttributeValueName")
This works dandy. Now we are being requested to add custom sorting options on D1. So we added a new field (iOrder) to the schema and changed the import to include this for the D1 table.
When adding the Dimension D1 using the code snippet above, I'm trying to tell it to use iOrder.
objAttribute.AttributeRelationships.Add("iOrder")
objAttribute.OrderBy = OrderBy.AttributeName
objAttribute.OrderByAttribute.Name = "iOrder"
after the last row I'm getting an error.
Object reference not set to an instance of an object.
Anyone have thoughts or examples of custom ordering USING C#/VB.NET? was utilizing this to get me this far.
.net vb.net ssas olap ssas-2012
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In this project we are dynamically creating a multidimensional cube via Microsoft.AnalysisServices in VB.NET. This code has been used for a few years and now we need to make a modification.
We add a fact table with a field D1.
We then add an assortment of master tables, including D1 and the relationships. So we programatically adding relations for D1 with something like:
DataSourceView.Schema.Relations.Add(pkColumn, fkColumn)
We the add the dimension D1 and define the Key/Name:
Private Function GenerateAttributeDimensionGeneric(ByVal objDatabase As Database, ByVal objDataSourceView As DataSourceView) As Object
Dim objDimension As New Dimension()
objDimension = objDatabase.Dimensions.Add("D1")
objDimension.Source = New DataSourceViewBinding(objDataSourceView.ID)
Dim objDimensionAttributesColl As DimensionAttributeCollection = objDimension.Attributes
Dim objAttribute As DimensionAttribute = objDimensionAttributesColl.Add("D1_PK")
objAttribute.Usage = AttributeUsage.Key
objAttribute.KeyColumns.Add("D1", "D1_PK", OleDbType.[Integer])
objAttribute.NameColumn = New DataItem("D1", "AttributeValueName")
This works dandy. Now we are being requested to add custom sorting options on D1. So we added a new field (iOrder) to the schema and changed the import to include this for the D1 table.
When adding the Dimension D1 using the code snippet above, I'm trying to tell it to use iOrder.
objAttribute.AttributeRelationships.Add("iOrder")
objAttribute.OrderBy = OrderBy.AttributeName
objAttribute.OrderByAttribute.Name = "iOrder"
after the last row I'm getting an error.
Object reference not set to an instance of an object.
Anyone have thoughts or examples of custom ordering USING C#/VB.NET? was utilizing this to get me this far.
.net vb.net ssas olap ssas-2012
In this project we are dynamically creating a multidimensional cube via Microsoft.AnalysisServices in VB.NET. This code has been used for a few years and now we need to make a modification.
We add a fact table with a field D1.
We then add an assortment of master tables, including D1 and the relationships. So we programatically adding relations for D1 with something like:
DataSourceView.Schema.Relations.Add(pkColumn, fkColumn)
We the add the dimension D1 and define the Key/Name:
Private Function GenerateAttributeDimensionGeneric(ByVal objDatabase As Database, ByVal objDataSourceView As DataSourceView) As Object
Dim objDimension As New Dimension()
objDimension = objDatabase.Dimensions.Add("D1")
objDimension.Source = New DataSourceViewBinding(objDataSourceView.ID)
Dim objDimensionAttributesColl As DimensionAttributeCollection = objDimension.Attributes
Dim objAttribute As DimensionAttribute = objDimensionAttributesColl.Add("D1_PK")
objAttribute.Usage = AttributeUsage.Key
objAttribute.KeyColumns.Add("D1", "D1_PK", OleDbType.[Integer])
objAttribute.NameColumn = New DataItem("D1", "AttributeValueName")
This works dandy. Now we are being requested to add custom sorting options on D1. So we added a new field (iOrder) to the schema and changed the import to include this for the D1 table.
When adding the Dimension D1 using the code snippet above, I'm trying to tell it to use iOrder.
objAttribute.AttributeRelationships.Add("iOrder")
objAttribute.OrderBy = OrderBy.AttributeName
objAttribute.OrderByAttribute.Name = "iOrder"
after the last row I'm getting an error.
Object reference not set to an instance of an object.
Anyone have thoughts or examples of custom ordering USING C#/VB.NET? was utilizing this to get me this far.
.net vb.net ssas olap ssas-2012
.net vb.net ssas olap ssas-2012
edited Nov 8 at 16:57
Al Fahad
755621
755621
asked Nov 8 at 16:33
user1272386
19110
19110
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212117%2fcustom-sorting-using-microsoft-analysisservices-to-generate-an-olap-cube%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown