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
Parents
No Data
Reply
  • 35319
    posted

    Hello Bob,

     

    I have been looking into your issue and you need to set the desired string value in the ‘DisplayName’ property of the DimensionMetadata like e.g. :

     

                CubeMetadata cubeMetadata = new CubeMetadata();

                cubeMetadata.DisplayName = "Sales Data";

                cubeMetadata.DataTypeFullName = "IGPivotGrid.Samples.Controls.Sale";

                cubeMetadata.DimensionSettings.Add(new DimensionMetadata()

                {

                    SourcePropertyName = "City",

                    DisplayName = "City",

                    DimensionType = DimensionType.Measure,

                    Aggregator = new Infragistics.Olap.TopCountOfStringAggregator()

                });

                cubeMetadata.DimensionSettings.Add(new DimensionMetadata()

                {

                    SourcePropertyName = "AmountOfSale",

                    DisplayName = "Amount Of Sale",

                    DisplayFormat = "{0:C2}",

                    Aggregator = new DoubleSumAggregator()

                });

     

    I am not exactly sure what happens in your application. Could you please check whether col.Caption return the desired string value ?

     

    I am attaching a sample application(PivotGridFlatDataDimensionMetaData.zip) that shows my suggestion.

    PivotGridFlatDataDimensionMetaData.zip
Children