Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
320
Hidden measure
posted

Hi,

 

Can I do a propery hidden measure but visible dimension ?

  • 1760
    posted

    Hi Resul,

    I can suggest you two approaches.

    The first one is to subscribe your flatdatasource to MetadataTreeItemAdding event. In the event handler you can hide the measure generated from a property.

    Sample code in c#:

    if (e.Item.ItemType == ItemTypes.Measure && (IMeasure)e.Item.DataObject != null && ((IMeasure)e.Item.DataObject).UniqueName == "<measure unique name>")

    { e.Cancel = true; }

    Sample code in vb:

    If e.Item.ItemType = ItemTypes.Measure AndAlso DirectCast(e.Item.DataObject, IMeasure) IsNot Nothing AndAlso DirectCast(e.Item.DataObject, IMeasure).UniqueName = "<measure unique name>"

    Then  e.Cancel = True End If

    The second approach is to set DimensionType property of a DimesionMetadata instance while creating flatdatasource in code behind.

    Sample code c#:

    DimensionMetadata unitsMetaData = new DimensionMetadata();            

    unitsMetaData.SourcePropertyName = "<PropertyName>";

    unitsMetaData.DimensionType = DimensionType.Dimension;

    Sample code vb:

    Dim unitsMetaData As New DimensionMetadata()

    unitsMetaData.SourcePropertyName = "<PropertyName>"

    unitsMetaData.DimensionType = DimensionType.Dimension