Prologika Forums
Making sense of data

ADOMD.NET Server (Sample) Code

rated by 0 users
This post has 1 Reply | 2 Followers

Top 500 Contributor
Posts 1
Chernomor Posted: Tue, Sep 12 2006 9:08 PM

I am trying to create a stored procedure (using an example from the book) that retrives product items which sales volume variance is below certain level using the following code:

Public Shared Function FindLowVarEntries(ByVal InputProductSet As [Set], ByVal InputTimeSet As String, ByVal SalesVolume As String, ByVal VarLowLimit As Decimal) As [Set]

Dim oMDXVal As MDXValue, oResSet As SetBuilder = New SetBuilder
Dim oTuple As Tuple, strContext As String, oExp As Expression = New Expression

For Each oTuple In InputProductSet.Tuples
   strContext = GetCurrentContextFromTuple(oTuple)
   oExp.ExpressionText = "Var( " & InputTimeSet & ", " & SalesVolume & ")"
   oMDXVal = oExp.Calculate(oTuple)
   If oMDXVal.ToDecimal <= VarLowLimit Then
     oResSet.Add(oTuple)
   End If
Next oTuple

Return oResSet.ToSet
End Function

The above code is working but does not return any rows. When I used the above procedure from the MDX query I tried to pass either Product Set as the InputProductSet or the crossjoint between the product set and the time set. Nothing worked. It returned no rows.

Please help.

Thanks.

Top 10 Contributor
Posts 1,858
When you say it returns no rows, how did you test? If the set has any tuples in it (you can debug the stored procedure to find), you should be able to see the set member when you drop the set on rows. BTW, it seems like you scenario could be easier to implement if you just use the Filter() function. It will be faster and simpler. Search this forum for examples of Filter().
Page 1 of 1 (2 items) | RSS