0

I am creating a PivotViewer application to show sales history of store branches for a retail businesses.

We are creating dynamic collections from an sql database when the application is opened. The sql query groups the sales amounts by month.

The pivotViewer applications shows each branch and its related sales history amount. however because the sales amount is grouped by month we are getting 12 different images of the store in the results field. This makes the results meaningless.

For example if a user selects the Chadstone store and the sales history for Jan, Feb and March the results field shows 3 different images. Instead we would like it to show 1 result with the figures for each month summed by the year.

I have done some research and it seems Pivot Viewer only reads the lines from the collection and cannot complete any calculations.

Does anyone know if this is true or how it can be resolved?

Thanks

3 Answers3

0

Sadly, the PivotViewer control doesn't support this capability at the moment. I think with the ability to perform and display the result of calculations, the PivotViewer control would be fantastic for visualising data in place of reports. Unfortunately, it's a missing piece of the puzzle, and I haven't found any workable way of implementing this sort of behaviour (it's a very locked down control, and is hard to add functionality to). I spent a bit of time trying, then decided it wasn't feasible. PivotViewer is to be made a core control in Silverlight 5, and I was expecting a lot of functionality to be added, hopefully allowing this sort of scenario. However, many announced features of Silverlight 5 were left out of the current beta, this being one of them. We'll need to cross our fingers that the ability to implement this will be available when it's updated for Silverlight 5 (likely with Silverlight 5 beta 2).

Chris

Chris Anderson
  • 8,279
  • 2
  • 20
  • 18
0

To accomplish this, you are going to have to add the additional processing on the server side (where you are generating your CXML). It is true, the current PivotViewer is simply that, a viewer. It takes the data that is in the CXML file and displays it with the deep zoom image that is linked to it.

So to handle your situation, you would need to process your query before generating your CXML or your image. Then you can group your items at that point and add any summation that you need. You just have to keep in mind that you are only displaying what is in the CXML, but you can put whatever you want in that CXML.

As far as SL5, you still won't have any calculations per se. You will be able to use object collections in a more standard "ItemsSource" type of way, but it will still be displaying what is in that data. However, like the CXML, you can combine your monthly data into a single object and display off of that object.

Tony

0

I hooked up an event handler onto the property changed and did the following...I used this to add Pins to a Bing map and it worked fine.

  void PivotViewer_PropertyChanged( object _Sender, System.ComponentModel.PropertyChangedEventArgs _Args )
  {
     if( _Args.PropertyName == "InScopeItemIds" )
     {
        PivotViewer pivotViewer = ( _Sender as PivotViewer );

        foreach( string isii in pivotViewer.InScopeItemIds )
        {
           PivotItem pi = pivotViewer.GetItem( isii );
           /*
              Do some work on the items in view?
            */

        }
     }
  }
David Gray Wright
  • 797
  • 1
  • 8
  • 31