Is there a way (10.3 or 11.1) to add new fields in the dataselector (connected to OLAP source) during runtime?
I want to add just a new measure that shows a value p.e. always 0 or a new dimension with one attribute.
Hi
Are you sure there is a measure in database with same name you specify for adding in datasource?
Todor
at Infragistics.Olap.Xmla.XmlaDataProvider.GetSlicerAxis(ICollection`1 measures, ICollection`1 filterItems)
at Infragistics.Olap.Xmla.XmlaDataProvider.CreateQuery(List`1 filterItems, List`1 rowItems, List`1 columnItems, List`1 measures, ICube cube)
at Infragistics.Olap.Xmla.XmlaDataSource.InitializeQuery()
at Infragistics.Olap.DataSourceBase.RefreshGrid()
at Infragistics.Olap.DataSourceBase.set_DeferredLayoutUpdate(Boolean value)
at Infragistics.Controls.Grids.PivotExtensions.ModifyCollections(IOlapViewModel viewModel, ModifyCollectionInfo modifyCollectionInfo)
at Infragistics.Controls.Grids.DropTriggerAction.AssociatedObjectDrop(Object sender, DropEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Infragistics.DragDrop.DragSource.OnDrop(DropEventArgs args)
at Infragistics.DragDrop.DragDropManager.OnDrop(MouseEventArgs mouseEventArgs)
at Infragistics.DragDrop.DragDropManager.EndDrag(Boolean dragCancel)
at Infragistics.DragDrop.DragDropManager.QueryContinueDrag(DependencyObject sender, Boolean escapePressed, Boolean mouseReleased)
at Infragistics.DragDrop.DragDropManager.OnMouseLeftButtonUp(Object sender, MouseButtonEventArgs e)
at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)
The new field appears in the fields' list (first screenshot)
But when I try to add it in the measures area I get an error (second screenshot)
HI
I guess that you try to add new field before the metadata tree is populated. So the best place to do this is when Metadata property is changed
The snippet below shows how to do this
dataSource.PropertyChanged += (s, args) => { if (args.PropertyName == "Metadata") { // put your code here ; } };
Regards
Todor,
thank you for your answer.
I get an error :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at ((DataSourceBase)dataSelector.DataSource).Metadata[0].Items[0].Items.Add(item);
any ideas?
Regards,
Dimitris