Hi, I've been recently playing with the online samples and have a couple of questions relating to the row/column headers. From the XAML for flatdatasource, even though display names are defined for the field (dimensionMetadata), for example, "Units sold" for NumberOfUnits, when drag/dropping the field from the Dataselector to any area within the datacollector window or the pivot grid window, the SourcePropertyName "NumberOfUnits" is displayed instead. Is it by design? If yes, how can we customize it so that displaynames are displayed?
<igOlap:CubeMetadata DataTypeFullName="Infragistics.Web.SampleBrowser.SilverlightDV.Samples.PivotGrid.Sale" DisplayName="Sales Data"> <igOlap:DimensionMetadata SourcePropertyName="NumberOfUnits" DisplayName="Units sold"/> <igOlap:DimensionMetadata SourcePropertyName="AmountOfSale" DisplayName="Amount of sale" DisplayFormat="{}{0:C2}"/> </igOlap:CubeMetadata>
http://samples.infragistics.com/sldv/RunSamples.aspx?cn=pivot-grid#/pivot-grid/flatdatasource-xaml
Thanks,
Hi
You can mention that this property exists like measure and like dimension. When you drag drop dimensions really you drag drop hierarchy from that dimension. So the name displayed into data selector is name of hierarchy. To define hierarchy you should use HierarchyDiscriptor. You can read more about hierarchy here
Todor
Hi Todor,
Below is the sample I took from one or two of your posts to build the DataTable and dynamic type for that datatable which is then bound to Itemsource of the FlatDatasource.
private DataTable GetTable(){ // // Here we create a DataTable with four columns. // DataTable table = new DataTable(); table.TableName = "Sales"; table.Columns.Add("Dosage", typeof(double)); table.Columns.Add("Drug", typeof(string)); table.Columns.Add("Patient", typeof(string)); table.Columns.Add("Date", typeof(DateTime));
// // Here we add five DataRows. // table.Rows.Add(25.1, "Indocin", "David", DateTime.Now); table.Rows.Add(50, "Enebrel", "Sam", new DateTime(2011, 1, 1)); table.Rows.Add(10, "Hydralazine", "Christoff", new DateTime(2011, 2, 2)); table.Rows.Add(21, "Combivent", "Janet", new DateTime(2011, 3, 3)); table.Rows.Add(100.2, "Dilantin", "Melanie", new DateTime(2011, 4, 4)); return table;}
private IEnumerable BuildItemsource(DataTable table){ DynamicTypeBuilder typeBuilder = new DynamicTypeBuilder { DynamicAssemblyName = "MyAssembly", DynamicTypeName = "PatientInfo" };
... }
Here is the xaml defined the flatdatasource.
<FlatData:FlatDataSource x:Key="FlatDataSource" ConnectionSettings="{StaticResource FlatDataConnectionSettings2}" Cube="PatientInfo" Rows="[Patient].[Patient]" Columns="[Date].[Date]" Measures="Dosage" >
<FlatData:FlatDataSource.CubesSettings> <FlatData:CubeMetadata DataTypeFullName="PatientInfo" DisplayName="Patient Information"> <FlatData:DimensionMetadata SourcePropertyName="Date" DisplayName="Visit Date"/> <FlatData:DimensionMetadata SourcePropertyName="Patient" DisplayName="Patient Name" /> <FlatData:DimensionMetadata SourcePropertyName="Dosage" DisplayName="Dos Age" DisplayFormat="{}{0:C2}" /> </FlatData:CubeMetadata> </FlatData:FlatDataSource.CubesSettings>
<!--<FlatData:FlatDataSource.HierarchyDescriptors> <FlatData:HierarchyDescriptor SourcePropertyName="Date" HierarchyName="Visit Date" /> <FlatData:HierarchyDescriptor SourcePropertyName="Patient" HierarchyName="Patient Name" /> </FlatData:FlatDataSource.HierarchyDescriptors>-->
</FlatData:FlatDataSource>
Here is the screenshot when I run the my sample app.
Those fields (dimensions) don't really have any hierachy and I want it "look" that way. However, since you've mentioned that I need to define hierachy for the dimensions in order to see or define user-friendly name for the dimensions, I've tried to add this.
<FlatData:FlatDataSource.HierarchyDescriptors> <FlatData:HierarchyDescriptor SourcePropertyName="Date" HierarchyName="Visit Date" /> <FlatData:HierarchyDescriptor SourcePropertyName="Patient" HierarchyName="Patient Name" /></FlatData:FlatDataSource.HierarchyDescriptors>
Now, run the app it looks like this.
Then,
When I drag & drop the "Patient Name" dimension, I got the exception.
I've tried some other alternates, but it's still not working.
In summary, all I want to achieve is that the ability to map user-friendly names for all the fields come from a DataTable. End-users should see and directly work on the display names.
Quy
What was the problem? I'm going thru the same issues and cant figure it out.
Thank you.
Nevermind, Todor! I've just figured it out. Thanks!