Hi,
I'd like to ask if it is possible to change the captions of the measures/dimensions generated automatically by a flatdatasource (based on an IEnumerable)? So if the flatDataSource.ItemsSource is set to an IEnumerable and the captions are like "PRDGRP" and "ST_DATE" by default, then I'd like to display them in the dataselector as "Product Group" and "Start date". Is it possible to change the captions of the items in the data selector?
Thanks and best regards,
Tamas
Dear Plamen,
Thank you very much, it works fine. It was the fullname that was not correct. Thanks for your help!
Have a nice day,
Tamás
Hello,
What is the type of flatData instance? I think that is your IEnumerable that you use as data source. As DataTypeFullName you need to pass the full type name of items stored into the IEnumerable. If your data source is an IEnumerable<T> you need to pass typeof(T).FullName:
CubeMetadata csettings = new CubeMetadata { DataTypeFullName = typeof([Your Items Type Here])ToString(), DisplayName = "DisplayNameXYZ" };
Plamen.
Hi Plamen,
Now it does not give an error, but the texts are still not changed. Here is my code:
CubeMetadata csettings = new CubeMetadata { DataTypeFullName = flatData.GetType().ToString(), DisplayName = "DisplayNameXYZ" }; int i = 0; foreach (KeyValuePair<object, object> pair in list[0]) { DimensionMetadata dm = new DimensionMetadata(); dm.DisplayName = texts[i]; dm.SourcePropertyName = pair.Key.ToString(); csettings.DimensionSettings.Add(dm); i++; } FlatDataConnectionSettings flatDataSettings = new FlatDataConnectionSettings(); FlatDataSource flatDataSource = new FlatDataSource { ConnectionSettings = flatDataSettings }; flatDataSource.CubesSettings.Add(csettings); flatDataSource.ItemsSource = flatData;
Maybe the problem is with this line:
new CubeMetadata { DataTypeFullName = flatData.GetType().ToString(), DisplayName = "DisplayNameXYZ" };
What exactly should be in DataTypeFullName? Maybe flatData.GetType().ToString() is not exactly what is needed.
Ok,
Try to initalize FlatDataSource in thos way:
FlatDataConnectionSettings flatDataSettings =
new FlatDataConnectionSettings();
FlatDataSource flatDataSource =
new FlatDataSource
{
ConnectionSettings = flatDataSettings
};
Unfortunately if I add this to the end then I got an error at this line,
flatDataSource.CubesSettings.Add(csettings);
because flatDataSource.CubesSettings is null. I cannot create it,
flatDataSource.CubesSettings = new List<CubeMetadata>();
since it is read only.