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
630
DimensionMetadata ignored
posted

Hello,

I'm using a FlatDatasource and struggling to get control of how the Dimensions display in the DataSelector -- I want them to display a nice-looking string instead of the raw property names, but I can't get it to work. The data is coming from a DataTable which I've converted into a list of "dynamic objects". I'm building the Dimensions and Hierarchies based on the columns found in the original table.

Here's a watered down version of what I've tried (which seems to be exactly what's in the documentation).

flatDataSource.DimensionsGenerationMode = DimensionsGenerationMode.Mixed;
CubeMetaData cubeMetadata = new CubeMetadata();
foreach (DataColumn col in myTable.Columns)
   {
// This seems to have no effect:
       DimensionMetaData dm = new DimensionMetadata()        {            SourcePropertyName = col.ColumnName,            DisplayName = col.Caption,
       };        cubeMetadata.DimensionSettings.Add(dm);                        //heirarchy        HierarchyDescriptor hier = new HierarchyDescriptor               
{            SourcePropertyName = col.ColumnName,            HierarchyName = col.Caption,            HierarchyDisplayName = col.Caption        };
       HierarchyLevelDescriptor allLevel = new HierarchyLevelDescriptor
       {
           LevelName = "All " + col.Caption + "s"
       };
       hier.LevelDescriptors.Add(allLevel);
       HierararchyLevelDescriptor entriesLevel = new HierarchyLevelDescriptor
       {
            LevelName = col.Caption,
            LevelExpressionPath = col.Caption
       };
       hier.LevelDescriptors.Add(entriesLevel);
       flatDataSource.HierarchyDescriptors.Add(hier);
  
 }
 flatDataSource.CubesSettings.Add(cubeMetadata);

I want the Dimension to display using the "Caption" property, not the "ColumnName" property from the column.
I'm doing this by setting the DisplayName in the DimensionMetadata, but it seems to be ignored. Am I doing something wrong?

Thanks,

Bob