Hi,
Not really sure if this should be under WinPivotGrid or under FlatDataSource, feel free to move it if it is in the wrong place.
I'm trying to save the state in which a user has left a WinPivotGrid, specifically the Rows, Columns, Filters and Measures as used in the FlatDataSourceInitialSettings:
Dim settings = New FlatDataSourceInitialSettings() With { _ .Rows = "[Sales].[Product]", _ .Columns = "[Sales].[SalesPerson]", _ .Measures = "[Sales].[Amount]" .Filters = "" _}
The final goal is to be able to save the configuration of Rows, Columns, Measures and Filters used so a user can go back to the report as it was with a simple click, so I would have to know the Rows, Columns, Measures and Filters to be able to pass it as FlatDataSourceInitialSettings when reloading the cube.
I have tried to obtain that from the WinPivotGrid and from the FlatDataSource, I can see that they are set inside the FlatDataSource in DirectCast(MyDS.dataSource, Infragistics.Olap.FlatData.FlatDataSourceInternal).RowAxis for example, but since that is "Internal / Friend" I can't enumerate it at runtime.
What would be the best way to achieve what I need?
Regards
Hello Edgar,
Your welcome, and if there is anything else I can assist you with or have any questions I can certainly help out. Thanks.
Hi Michael,
Thanks a lot for your help, in fact I just tested your suggestion and it works for what I needed!!!
Just in case someone else needs to do this, this are the key things that I used:
' Events to handle Hierarchies, Measures and Filter changes in the FlatDataSource (ds) AddHandler ds.AxisAddHierarchyAsyncCompleted, AddressOf ds_AxisAddHierarchyAsyncCompleted AddHandler ds.AxisRemoveHierarchyAsyncCompleted, AddressOf ds_AxisRemoveHierarchyAsyncCompleted AddHandler ds.AddFilterAsyncCompleted, AddressOf ds_AddFilterAsyncCompleted AddHandler ds.RemoveFilterAsyncCompleted, AddressOf ds_RemoveFilterAsyncCompleted AddHandler ds.AddMeasureAsyncCompleted, AddressOf ds_AddMeasureAsyncCompleted AddHandler ds.RemoveMeasureAsyncCompleted, AddressOf ds_RemoveMeasureAsyncCompleted
'Example of the handler of one event, Rows an Cols are lists that hold the Hierarchies used
Private Sub ds_AxisAddHierarchyAsyncCompleted(ByVal sender As Object, ByVal e As AxisAddHierarchyAsyncCompletedEventArgs) If e.AxisType = AxisType.Column Then If Not Cols.Contains(e.HierarchyUniqueName) Then Cols.Add(e.HierarchyUniqueName) ElseIf e.AxisType = AxisType.Row Then If Not Rows.Contains(e.HierarchyUniqueName) Then Rows.Add(e.HierarchyUniqueName) End If End Sub
Thanks Again
Yes, I have verified with my team that you won't be able to achieve this as you would with our WPF version. Also, if you are not already aware, you can handle the following OlapDataSource events and analyze it's member(s).
• AxisAdd/RemoveHierarchyAsyncCompleted • AddFilterAsyncCompleted • AddMeasureAsyncCompleted
They each expose a unqiue name member that can help you track and retrieve the the addition and removal of hierarchies, filters and measure information at the time the save/load process needs to be triggered.
Let me know if you have any questions.
Thanks for your response. I understand that the WinPivotGrid and the FlatDataSource controls are new hence they don't necessarily have all the standard functionality that you would expect from them when they mature. I will post as "New Ideas" both the "Save and Load Layout" and the "Export to Excel" just to document them (I don't really think they "new" ideas, I see them as basic/standard stuff that is supported by all your other grids).
Sadly, I don't have license for WPF controls, so I cant use your recommendation, so I just wanted to verify if there is any other way just to get the currently selected measures , dimensions, columns rows, and filters, so I can save them on my own and use them as the initial configuration for the FlatDataSource later.
Regards,
Saving and loading a layout for the PivotGrid including selected measures , dimensions, columns rows, and filters, etc. has been determined to be a new product idea for our Windows Forms platform. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
As an alternative you can implement the WPF privot grid, which supports Save and Load Data Source Customizations, and host the control in your Windows Forms application.
Let me know if you have any questions regarding this matter.