RadPivotFieldList - changing cube at runtime

12 posts, 0 answers
  1. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 13 May 2014 Link to this post

    Hi,

    I am building a cube/analytics viewer for a client and the RadPivotGrid and RadPivotFieldList combination works really well until we try to swap the connection string and point the RadPivotFieldList  control at the new cube.

    However when we change the cube in the connection string the RadPivotGrid reloads with the new report, however the  RadPivotFieldList does not refresh it's field list, so we are stuck with the same fields as the first cube.
    Both cubes work as we can load either of them first, just never change it.

    I am doing this in codebehind and viewmodel (long story) and storing the serialised data provider in SQL, (this all works beautifully).

    My latest code looks like this;

    private Telerik.Pivot.Adomd.AdomdDataProvider _provider { get; set; }


     var x = _viewModel.DataProvider;
    _provider = new AdomdDataProvider();
    _provider = (Telerik.Pivot.Adomd.AdomdDataProvider)x;

    var url = _viewModel.Analytics.GetOrDefault("AnalyticsURL");
    var database = _viewModel.SelectedCube.Catalog;  
    var cube = _viewModel.SelectedCube.Cube;  

    var ConnectionSettings = new Telerik.Pivot.Adomd.AdomdConnectionSettings()
    {
        Cube = cube,
        Database = database,                   
        ConnectionString = String.Format("Data Source={0}", url)
    };
    _provider.ConnectionSettings = ConnectionSettings;
     
    _provider.BeginInit();
     
    radPivotGrid.DataProvider = _provider;
    radPivotFieldList.DataProvider = _provider;

    _provider.EndInit();


    The 'Cube' is the only bit that changes in the connection string.
    I have looked online and cannot find any links to switching the cube at runtime, is there anyway to do this?

    thanks for the help.
    craig
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 13 May 2014 Link to this post

    Hi Craig,

    It looks like you have missed to set Initial Catalog value in your Connection string. As shown in our documentation here, you have to set Initial Catalog value to your database name.

    Could you try adding Initial Catalog value in your connection string and inform us if everything is working fine on your side?

    I'm looking forward to hearing from you.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 14 May 2014 in reply to Rosen Vladimirov Link to this post

    Hi Rosen,

    Thanks for the reply, I have tried adding the initial catalog into the connection string:  

       var ConnectionSettings = new Telerik.Pivot.Adomd.AdomdConnectionSettings()
                    {
                        Cube = cube,
                        Database = database,
                        ConnectionString = String.Format("Provider=MSOLAP.5;Persist Security Info=True;Data Source={0};Initial Catalog={1};", url,  database)
                    };

    Which gives me the same outcome as before that is, the PivotGrid will load and switch data but FieldList stays the same.
    Does the type of datasource make any difference, we have to use the msmdpump type -  http://[server]/xxxxx_OLAP/msmdpump.dll

    cheers
    craig
  5. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 15 May 2014 Link to this post

    Hello Craig,

    There's no need to use http protocol (msmdpump.dll format) in order to use AdomdDataProvider. I've prepared a sample project to demonstrate the required approach. You have to modify the connections strings in order to get it work. I've also recorded a short video which demonstrates how the project works on our side (I've used connections to our internal OLAP cubes).

    Hope this helps.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 20 May 2014 in reply to Rosen Vladimirov Link to this post

    Hi Rosen,

    Unfortunately due to server setup, the only access we have to the cube is via the msmdpump protocols.
    Which in theory takes and gives in the same was as a direct connection?

    Is there any way to accomplish this cube change using the msmdpump?

    cheers
    craig
  7. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 21 May 2014 Link to this post

    Hi Craig,

    We haven't noticed any issues with changing the connection string at runtime, no matter if the connection was made through http (msmdpump.dll format) or directly. Have you tried the project I've sent you with your cubes?

    As you have configured the http access, you can try using our XmlaDataProvider and see if it will work in this case. XmlaDataProvider is designed to work with msmdpump.dll, so you should be able to integrate it easily in your project.

    I'm looking forward to hearing from you.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  8. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 04 Jun 2014 in reply to Rosen Vladimirov Link to this post

    Hi,

    Unfortunately changing the provider is a last resort (we are serialising the AdomdDataProvider into our DB).
    I have upgraded the telerik controls hoping that there might be a fix, but had no luck.

    The attached image is a shot as I step through each of the connection providers. the cube is definitely changing each time and the RadPivotGrid is updating its UI correctly, but the RadPivotFieldList is not.
    The full ode I have now is below.
    The only thing I can see that is different between the two Rad controls in question is that the DataProviders are classified differently in intellisense?
    The grid says "Gets or sets the data provider"
    The FieldList says "Gets or Sets the Telerik.Windows.Controls.RadPivotFieldList.DataProvider associated with this control. This is a dependency property."

    Does this mean we need to 'do' something different to the FieldList control to force refresh?

    //My code
    var x = _viewModel.DataProvider; // from view model
                if (x != null && _viewModel.SelectedReport != null) // from view model
                {
                    var url = _viewModel.Analytics.GetOrDefault("AnalyticsURL"); // from view model
                    var database = _viewModel.SelectedCube.Catalog;

                    _provider = new AdomdDataProvider(); 
                    _provider = (Telerik.Pivot.Adomd.AdomdDataProvider)x; 
                    _provider.ConnectionSettings = new Telerik.Pivot.Adomd.AdomdConnectionSettings()
                                                        { 
                                                            Cube = _viewModel.SelectedCube.Cube, // from view model
                                                            Database = database,
                                                            ConnectionString = String.Format("Provider=MSOLAP.5;Persist Security Info=True;Data Source={0};Initial Catalog={1};", url, database)
                                                        };

                    _provider.BeginInit();

                    radPivotGrid.DataProvider = _provider; // screen shot taken here
                   radPivotFieldList.DataProvider = _provider;
              
                    _provider.EndInit();
     
                }
                else
                {

                }


    Any help is much appreciated.
    cheers
    craig
  9. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 04 Jun 2014 Link to this post

    I have found a solution and its probably a cleaner option anyway.
    Code is now (code behind):

    var layout = _viewModel.DataProvider;
               if (layout != null && _viewModel.SelectedReport != null)
               {            
                    layout.BeginInit();
                    radPivotGrid.DataProvider = layout;
                    radPivotFieldList.DataProvider = layout;
                    layout.EndInit();
                    _provider = layout;                              
               }
               else
               {
               }

    In my viewModel:

    AdomdProviderSerializer provider = new AdomdProviderSerializer();
               try
               {

                   var url = this.Analytics.GetOrDefault("AnalyticsURL");
                   var database = this.SelectedCube.Catalog;

                   DataProvider = new AdomdDataProvider();
                   var p =   provider.Deserialize(DataProvider, xml.ToString());            
               
                   DataProvider.ConnectionSettings = new Telerik.Pivot.Adomd.AdomdConnectionSettings()
                   { 
                       Cube = this.SelectedCube.Cube,
                       Database = database,
                       ConnectionString = String.Format("Provider=MSOLAP.5;Persist Security Info=True;Data Source={0};Initial Catalog={1};", url, database)
                   };

               }

    For some reason splitting the logic up in this way allows the DataProvider to refresh when the connection is changed.

    Hope it helps someone else out there.
  10. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 05 Jun 2014 Link to this post

    Hi Craig,

    We are glad you have managed to achieve the desired. If you have any other questions, do not hesitate to contact us.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  11. chillfire
    chillfire avatar
    9 posts
    Member since:
    Apr 2008

    Posted 07 Jul 2014 Link to this post

    Hi,

    All was going well until I updated to the latest build of the WPF controls v.2014.2.617.40 and now the loading indicators on both grid and fieldList are visible even after the data has loaded?

    Is there a known bug/workaround for this as it was working on the 2013.3.xxx version?

    cheers
    craig
  12. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 07 Jul 2014 Link to this post

    Hello Craig,

    As I've answered in the support ticket, you've sent us, we are not aware of such issue and we were unable to reproduce it on our side. I've sent you our test project (its almost the same as the one that I've sent you before in this thread), so you could take a look at it and see if we are not missing something. I'll be waiting for your reply in the support ticket and I'll take care to update this thread once we have a solution of the issue.

    I'm looking forward to hearing from you.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  13. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 10 Jul 2014 Link to this post

    Hi,

    As I've promised, I'm updating this thread with the solution of the problem. It turned out the problem is related to some styles, after removing them and using StyleManager.ApplicationTheme in order to set Windows8Theme, everything is working as expected.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready