Hello, this is Christian from Saarbrücken in Germany.
I'm trying to change the xamPivotGrid-cells data after the Cube was generated and displayed, but without any success.
This is the structure of the businessobject-list that i am building and using as itemsource for the flatdatasource.
public class QMatrix : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private int? _soll = null; private int? _ist = null; public Mitarbeiter Mitarbeiter { get; set; } public Hauptaufgabe Hauptaufgabe { get; set; } public DateTime? Termin { get; set; } public int ID { get; set; } public int? Verantwortlicher { get; set; } public int? Soll { get { return _soll; } set { int? old = _soll; try { _soll = value; if (old != _soll) OnPropertyChanged("Soll"); } catch (Exception exception) { _soll = old; MessageBox.Show(exception.Message, "Property-Fehler", MessageBoxButton.OK); } } } public int? Ist { get { return _ist; } set { int? old = _ist; try { _ist = value; if (old != _ist) OnPropertyChanged("Ist"); } catch (Exception exception) { _ist = old; MessageBox.Show(exception.Message, "Property-Fehler", MessageBoxButton.OK); } } } public string Ausbilder { get; set; } public QMatrix() { Mitarbeiter = new Mitarbeiter(); Hauptaufgabe = new Hauptaufgabe(); } protected virtual void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } public class Mitarbeiter { public int ID { get; set; } public string Name { get; set; } public Mitarbeiter() { ID = -1; Name = "keiner"; } } public class Arbeitsplatz { public int ID { get; set; } public string Name { get; set; } public Arbeitsplatz() { ID = -1; Name = "keiner"; } } public class Hauptaufgabe { public int ID { get; set; } public string Name { get; set; } public Arbeitsplatz Arbeitsplatz{ get; set; } public Hauptaufgabe() { ID = -1; Name = "keiner"; Arbeitsplatz = new Arbeitsplatz(); } }
private void bildeCube() { //if (p1loaded == false || p2loaded == false || p3loaded == false) // return; try { Switched = false; FlatDataSource fs = new FlatDataSource() { ItemsSource = bildeItemsource(), Cube = XmlaDataSource.GenerateInitialCube("QMatrix"), Columns = XmlaDataSource.GenerateInitialItems("[Hauptaufgabe]"), Rows = XmlaDataSource.GenerateInitialItems("[Mitarbeiter]"), Measures = XmlaDataSource.GenerateInitialItems("Ist,Soll"), }; fs.ResultChanged += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(fs_ResultChanged); CubeMetadata cubeMetadata = new CubeMetadata(); cubeMetadata.DisplayName = "QMatrix-Werte"; cubeMetadata.DataTypeFullName = typeof(QMatrix).FullName; cubeMetadata.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "Ist", DisplayName = "Ist", DisplayFormat = "{0} %" } ); cubeMetadata.DimensionSettings.Add(new DimensionMetadata() { SourcePropertyName = "Soll", DisplayName = "Soll", DisplayFormat = "{0} %" } ); fs.CubesSettings.Add(cubeMetadata); HierarchyDescriptor<QMatrix> hauptaufgabenHierarchy = new HierarchyDescriptor<QMatrix>(qmo => qmo.Hauptaufgabe); hauptaufgabenHierarchy.AddLevel(qmo => "Alle Arbeitsplätze", "Alle Arbeitsplätze"); hauptaufgabenHierarchy.AddLevel(qmo => qmo.Hauptaufgabe.Arbeitsplatz.Name, "Arbeitsplatz Bez."); hauptaufgabenHierarchy.AddLevel(qmo => "Alle Hauptaufgaben", "Alle Hauptaufgaben"); hauptaufgabenHierarchy.AddLevel(qmo => qmo.Hauptaufgabe.Name, LEVELNAME_HAUPTAUFGABEN); fs.AddHierarchyDescriptor(hauptaufgabenHierarchy); HierarchyDescriptor<QMatrix> mitarbeiterHierarchy = new HierarchyDescriptor<QMatrix>(qmo => qmo.Mitarbeiter); mitarbeiterHierarchy.AddLevel(qmo => "Alle Mitarbeiter", "Alle Mitarbeiter"); //mitarbeiterHierarchy.AddLevel(qmo => "", ""); mitarbeiterHierarchy.AddLevel(qmo => qmo.Mitarbeiter.Name, LEVELNAME_MITARBEITER); fs.AddHierarchyDescriptor(mitarbeiterHierarchy); //fs.SetMeasureAggregator((Infragistics.Olap.IMeasureViewModel)fs.Measures[0], Infragistics.Olap.MeasureAggregator.Average); //fs.SetMeasureAggregator((Infragistics.Olap.IMeasureViewModel)fs.Measures[1], Infragistics.Olap.MeasureAggregator.Average); Grid.DataSource = fs; DataSelektor.DataSource = fs; } catch (Exception exc) { Switched = true; MessageBox.Show(exc.Message, "F E H L E R", MessageBoxButton.OK); } finally { Cursor = Cursors.Arrow; } }
private List<QMatrix> bildeItemsource() { List<QMatrix> Werte = new List<QMatrix>(); QMatrix qmo; QMatrixV3.Web.V_QMATRIX_V2 qm; for (int i = 0; i < v_QMATRIX_V2DomainDataSource.DataView.Count; i++) { qm = (QMatrixV3.Web.V_QMATRIX_V2)v_QMATRIX_V2DomainDataSource.DataView[i]; qmo = new QMatrix(); qmo.ID = qm.ID; qmo.Termin = qm.TERMIN; qmo.Verantwortlicher = qm.VERANTWORTLICHER; qmo.Soll = qm.Q_SOLL; qmo.Ist = qm.Q_IST; qmo.Ausbilder = qm.AUSBILDER; foreach (QMatrixV3.Web.V_MITARBEITER ma in v_MITARBEITERDomainDataSource.DataView) { if (ma.ID == qm.MA_ID) { qmo.Mitarbeiter.ID = ma.ID; qmo.Mitarbeiter.Name = ma.BEZ_MITARBEITER; break; } } foreach (QMatrixV3.Web.V_HAUPTAUFGABEN ha in v_HAUPTAUFGABENDomainDataSource.DataView) { if (ha.ID == qm.H_AUF_ID) { qmo.Hauptaufgabe.ID = ha.ID; qmo.Hauptaufgabe.Name = ha.SEL_STRING; foreach (QMatrixV3.Web.V_ARBEITSPLAETZE ap in v_ARBEITSPLAETZEDomainDataSource.DataView) { if (ap.ID == ha.AP_ID) { qmo.Hauptaufgabe.Arbeitsplatz.ID = ap.ID; qmo.Hauptaufgabe.Arbeitsplatz.Name = ap.BEZ; break; } } break; } } Werte.Add(qmo); } return Werte; }
What I've tried:
Is there any way to manupulate the data and refresh the grid like overriding a method from flatdatasource-class or changing fields from olap-cells ???
thx
Chris
Hello SpyrosA,
I recommend submitting your thoughts and ideas on the following product ideas page:
http://ideas.infragistics.com/forums/192363-wpf/suggestions/5827844-xampivotgrid-display-data-changes-in-a-flatdatasou
Have a nice day!
Hi there,
I was wondering for version 15.2 if there is a way to do what zeroOne is saying
"Is there any planned way to refresh the data in the pivotgrid without having to reset all the measures etc so the user doesnt lose what they have built up? I realise I could save the current settings etc, but it seems inefficient to me."
Thanks
Spyros
Hi
You can change the value of cells in way shown in snippet below
private void Button_Click(object sender, RoutedEventArgs e) { object value = 5; pivotGrid.DataSource.Result.Cells[0, 0].SetValue(value, null, ""); pivotGrid.ArrangeLayout(); }
the cells array is the array with underlaying data.
RegardsTodor
Can we accomplish this now..?
Hi,
The 11.1 release is planned for April 2011.
Todor