Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
890
XamPivotGrid, FlatDataSource.LoadCustomizations, Exception "Item already added"
posted

Hello,

  I'am having a critical bug when I do FlatDataSource.LoadCustomizations which crash all the application. I have added a sample project to reproduce this bug: When launched, try to add a group by field of "book", and then try to filter on books "754K" and "754L", And ou will see on the group by fields "AssetType" and "Book" and with data only on books "754K" and "754L". And then you click Refresh, then the "Item is already added" exception is throwed and application crashes. What happens is that when you click Refresh, it will change the ItemSource by an List of data that doesn't have book 754L, and I think FlatDataSource.LoadCustomizations doesn't like this.

  You just have to launch the sample project and add the field Book and filter, and then click, you will see the bug. Can you please urgently give me a solution to this problem? Because this exception is not catchable and is fatal. Thanks a lot

  Regards

  

  

  

XamPivotGrid_LoadCustomizationsBug.zip
Parents
  • 34510
    Offline posted

    Hi pebg,

    This exception occurs because LoadCustomization is trying to add saved rows/columns/filters that are already present inside the FlatDataSource.  Your FlatDataSource has set the InitialValue for the Measures, Rows and Columns properties and this causes those dimensions/measures to be reloaded automatically if you change the ItemsSource.  What you should instead do is manually add the Measures, Columns and Rows that you want to be present when the FlatDataSource is created.  The following post is a good example showing how to manually add these:
    http://es.infragistics.com/community/forums/p/65089/329572.aspx#329572

    This approach requires that the FlatDataSource has been assigned to the pivot grid before you can access the FlatDataSource.Cube property so you will probably need to change your code a bit to make this work.  But it needs to be done if you want to call LoadCustomizations and not have the exception occur due to the FlatDataSource trying to apply the initial values on top of what is being loaded from the customizations.

Reply Children