Inserting a Column from second data source

4 posts, 0 answers
  1. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 24 Mar 2013 Link to this post

    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.
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 27 Mar 2013 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Shaun
    Shaun avatar
    37 posts
    Member since:
    Sep 2012

    Posted 27 Mar 2013 Link to this post

    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.



  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 29 Mar 2013 Link to this post

    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.
Back to Top