This is a migrated thread and some comments may be shown as answers.

Inserting a Column from second data source

3 Answers 166 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
Shaun
Top achievements
Rank 1
Shaun asked on 24 Mar 2013, 09:24 PM
Hi,

Is it possible to insert a column that's not part of the main datasource of a pivot grid, kinda difficult to explain but what I want to do is:

1. Show a pivot grid with aggregate columns over a time period.
2. Insert a start position from another datasource.

If you look at the attached image, it might give a better clue as to what I want to do:

The Column in Red, Start Inventory, is the column I want to insert, this data comes from a second dataset, the key being stock item.

The Totals Column is just the sum of Purchases / Sales / Loss.

What would be cool would be to add a second column that would calculate the Start Inventory - Totals (not shown on image)

Hope this makes sense,

Cheers

Shaun.


Cheers

Shaun.

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 27 Mar 2013, 02:47 PM
Hi Shaun,

Thank you for writing.

This functionality is not supported and a feature request for such already exists. Feel free to add your vote for it here: 
http://www.telerik.com/support/pits.aspx#/details/Issue=12876 - this item concerns adding an unbound data column to the Pivot calculations.

For the time being, I am not able to provide you with a specific time frame for this feature request.

As a workaround you should try to incorporate this column to the data source and pass this data source to the PivotGrid DataProvider.

I hope this helps.

Greetings,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Shaun
Top achievements
Rank 1
answered on 27 Mar 2013, 07:16 PM

Hi Peter,

Thanks for getting back to me, the new feature will make this control very usable, great work.
As a work around I have tried modifying the datasource but with no success.

Another option would be to tack on / position a grid at the end column of the pivot grid.
The problem I have is finding the position of the last column, so far I can set the position of the new grid to the end of the pivot component, but there could be a large gap from the last column to the end of the pivot component. Aligning rows is also a challenge.

Any suggestions would be great.

Cheers

Shaun.



0
Peter
Telerik team
answered on 29 Mar 2013, 03:11 PM
Hello Shaun,

Thank you for writing back.

Аdding the new column to the data source and passing this data source to the PivotGrid DataProvider must update the PivotGrid because the grid will pivotize a new column for the calculations.

I am not sure that I fully understand your intention. You can set the size to the particular column using the following code:
radPivotGrid1.PivotGridElement.UpdateCompleted += new EventHandler(PivotGridElement_UpdateCompleted);
  
 void PivotGridElement_UpdateCompleted(object sender, EventArgs e)
 {
            foreach (PivotGroupNode node in this.radPivotGrid1.PivotGridElement.GetColumnGroups())
           {
                if (node.Name == "Sum of Freight")
                {
                    node.PreferredSize = 300;
                }
            }
  }

Please, bear in mind that this code should be performed when the UI is already built.

I hope this helps.

Greetings,
Peter
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
PivotGrid and PivotFieldList
Asked by
Shaun
Top achievements
Rank 1
Answers by
Peter
Telerik team
Shaun
Top achievements
Rank 1
Share this question
or