We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Get Underlying Raw Objects When Using Data Optimizations

Hello,

I'm using the PivotGridControl to display large grids and thus need to use some of the optimization features. Specifically, it seems like setting 'UseIndexedEngine' to true along with setting a GetValue delegate solves our performance issues. However, when the IndexedEngine is enabled, the function PivotEngine.GetRawItemsFor(rowIndex, columnIndex) throws an exception. I've also tried using PivotEngine.IndexEngine[rowIndex, columnIndex].RawItems but that property is always null.

Is it possible to get the underlying items when using any data optimization settings?

Thanks,

Robert


7 Replies 1 reply marked as answer

SJ Sathiyathanam Jeyakumar Syncfusion Team May 2, 2023 04:59 PM UTC

Hi Robert van der Leek,

We are currently checking feasibility to achieve your requirement and we need two more business days to do this. We will update you with further details on May 4, 2023.


Regards

Sathiyathanam



RV Robert van der Leek May 2, 2023 05:46 PM UTC

Hi Sathiyathanam,


Thank you for the update. Please let me know if you need more information and good luck!


Thanks,

Robert



SJ Sathiyathanam Jeyakumar Syncfusion Team May 4, 2023 05:23 PM UTC

Robert van der Leek,

We have analyzed the provided details and found that you have used the concept of UseIndexEngine to improve the performance of PivotGrid. The Index Engine is used to load the collection of data faster than the PivotEngine. If you want to obtain the RawValues in the UseIndexEngine scenario, you can enable CacheRowValues as true and then call the GetRawItemsFor method. This will enable you to obtain the RawValues.

private void InitializePivotGrid()

{

    //Adding ItemSource to the Control

    this.pivotGridControl1.PivotEngine.UseIndexedEngine = true;

    this.pivotGridControl1.PivotEngine.GetValue = ItemObjectLookup;

    this.pivotGridControl1.PivotEngine.CacheRawValues = true;

}

 

private void button1_Click(object sender, EventArgs e)

{

    int row = 3;

    int col = 3;

    PivotCellInfo cellInfo = this.pivotGridControl1.PivotEngine[row, col];

    var rawItems = this.pivotGridControl1.PivotEngine.GetRawItemsFor(row, col);

}


If the provided response does not meet your requirement, kindly share more details about your requirement along with the code snippets which you have tried at your end.


Attachment: Sample_bfe27818.zip


RV Robert van der Leek May 4, 2023 10:08 PM UTC

Hello Sathiyathanam,


  1. We want to assign the ItemSource to an empty DataTable and then modify that table's rows and columns over time. When we modify the table, we want to set different pivot items and refresh the PivotGrid appropriately. This caused an issue since it seems the cache is built when the ItemSource is assigned. To work around this, I set 'PivotGrid.EnableUpdating = true' after filling the DataTable. Setting this calls PivotGridControlBase.PivotEngine.ResumeComputations(true) which initializes some otherwise null properties. (PivotEngine.rowHeaders for example) Is there a proper way to rebuild this cache and initialize these properties to avoid null references later?
  2. We also need to be able to edit value cells. When editing, we need to get the underlying objects to get an ID from them so we can track these changes. In our case, each cell should only ever have one underlying object. If we could attach this one object's ID to the cell or something we wouldn't need to get the underlying items.


I noticed that with IndexEngine enabled and CacheRawValues set to true, any call to GetRawItemsFor(row, col) seems to return all rows in the DataTable/ItemSource. This is true for your example as well. Shouldn't this only return the items that contribute to that particular cell's value?


Sorry for marking your reply as the answer before fully confirming and sorry for no code sample. I will modify your sample to make it more representative of my situation and post here soon.


Thanks much,

Robert



RV Robert van der Leek May 5, 2023 03:57 PM UTC

Hello Sathiyathanam,

Attached is a more representative example of what we're doing. It seems the two problems now are that with the Cache and IndexEngine enabled, (1) GetRawItemsFor returns all items in the data source, not just those for that cell row, col index and (2) that the cache is not refreshed. Both of these issues are evident in the sample attached. To see this, simply click the buttons in the form in their numbered order.


Please let me know if you need more information.

Thanks again,

Robert




Attachment: Sample_Reworked_4cd662bd.zip


SJ Sathiyathanam Jeyakumar Syncfusion Team May 5, 2023 04:49 PM UTC

Robert,

Thank you for providing a sample. We will review the provided sample and check the feasibility of achieving your requirements, and then provide further details on May 9, 2023.



SJ Sathiyathanam Jeyakumar Syncfusion Team May 9, 2023 04:46 PM UTC

Robert,

We regret for the inconvenience.

When we set CachedRowValue to true, all row values will be returned when we call the GetRawItemsFor method. Enabling UseIndexEngine utilizes a different calculation algorithm for the PivotEngine that is based on indexing. This results in improved performance as raw data computation is done based on indexing. However, with indexing, it is not possible to obtain GetRawItems for a specified row and column index. 

Let us know if you need any further assistance on this.


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon