Hi.
I try to use used based optimization with the following AMO code. But I get an error, that an attribute of a dimension is NULL and the AggregationDesigner cannot build an aggregate on this. Is this a problem in the code (like a problem with the query list (I do put the "Dataset" column into it only actually. ). - If I try to build an aggregate with the wizard in SSDT everything is fine.
Cheers,
Nils
Dim strSQL As String = "SELECT [Dataset],COUNT(*) FROM [dbo].[OlapQueryLog] WHERE MSOLAP_ObjectPath = @ObjPath AND StartTime >= @StartTime GROUP BY [Dataset]" Dim SqlComm As SqlCommand = New SqlCommand(strSQL, _SqlConn) SqlComm.Parameters.Add(StartTime) SqlComm.Parameters.Add(ObjPath) Dim SqlReader As SqlDataReader = SqlComm.ExecuteReader Dim FirstTime As Boolean = True Dim Finished As Boolean = False Dim Optimization As Double Dim Storage As Double Dim AggregationCount As Int64 If SqlReader.HasRows Then While SqlReader.Read QueryList.Add(SqlReader.GetString(0)) 'SqlReader.GetInt32(1).ToString + "," + End While With AggrDesign .InitializeDesign() While Not Finished And Optimization < MaxOptimization And Storage < MaxStorage And AggregationCount < MaxAggregationCount If FirstTime Then .DesignAggregations(Optimization, Storage, AggregationCount, Finished, QueryList) FirstTime = False Else .DesignAggregations(Optimization, Storage, AggregationCount, Finished) End If End While .FinalizeDesign() .Update() End With End If