Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

NamedSet Class

Represents a named set for a given cube.


Namespace:  Microsoft.AnalysisServices.AdomdClient
Assembly:  Microsoft.AnalysisServices.AdomdClient (in Microsoft.AnalysisServices.AdomdClient.dll)

public sealed class NamedSet

The NamedSet type exposes the following members.

Public propertyCaptionGets the caption of the named set.
Public propertyDescriptionGets the description of the NamedSet.
Public propertyDisplayFolderGets the fully qualified name of a display folder.
Public propertyExpressionGets the MDX set expression that defines the NamedSet.
Public propertyNameGets the name of the NamedSet.
Public propertyParentCubeGets a CubeDef that contains the NamedSet.
Public propertyPropertiesGets a PropertyCollection that contains the properties associated with the NamedSet.

Public methodEqualsDetermines whether two instances of NamedSet are equal. (Overrides Object.Equals(Object).)
Public methodGetHashCodeServes as a hash function for a particular type, suitable for use in hashing algorithms and data structures such as hash tables. (Overrides Object.GetHashCode.)
Public methodGetType (Inherited from Object.)
Public methodToStringReturns a String that represents the current object. (Overrides Object.ToString.)

Public operatorStatic memberEqualityDetermines whether two specified instances of NamedSet the same values.
Public operatorStatic memberInequalityDetermines whether two specified instances of NamedSet have different values.

A named set is a persisted set expression, which is associated with an alias and defined as part of the structure of a cube. In Multidimensional Expressions (MDX), a set expression can be a lengthy and complex declaration. A named set makes it easier to manage a set expression that is used regularly in MDX or XML for Analysis queries that involve the cube and provides a way of maintaining the set expression independently of the queries that use it.

A NamedSet encapsulates the alias and set expression of a named set, so that the metadata of the named set can be examined and incorporated into queries.

The following subroutine, given a CubeDef, iterates through the NamedSets collection and displays information about each NamedSet in the collection:

Public Sub ListNamedSets(ByRef CubeToCheck As CubeDef)

    ' Check the parameter before performing actions on it.
    If CubeToCheck Is Nothing Then
        Throw New System.ArgumentNullException("CubeToCheck")
        ' Iterate through the NamedSets collection of the
        ' CubeDef object.

            Dim nsetToCheck As NamedSet

            Debug.WriteLine("Found " & CubeToCheck.NamedSets.Count & _
                " named set(s) in cube:")

            For Each nsetToCheck In CubeToCheck.NamedSets
                Debug.WriteLine("Named Set:  " & nsetToCheck.Name)
                Debug.WriteLine("    Description:  " & _
                Debug.WriteLine("    Expression:   " & _
        Catch ex As AdomdConnectionException
            ' The connection could not be opened or was disconnected.
            ' This error can occur at any time, if the provider is 
            ' disconnected from the server.
            Throw ex
        Catch ex As AdomdErrorResponseException
            ' A response is received from a provider which indicates an error.
            Throw ex
        Catch ex As AdomdUnknownResponseException
            ' A response has been returned from the provider that 
            ' was not understood.
            Throw ex
        Catch ex As AdomdCacheExpiredException
            ' A cached version of an ADOMD.NET object is no longer valid.
            ' This error is typically raised when reviewing metadata.
            Throw ex
        Catch ex As AdomdException
            ' Any other error raised by ADOMD.NET.
            Throw ex
        Catch ex As Exception
            ' Any other error.
            Throw ex
        End Try
    End If
End Sub

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

© 2015 Microsoft