Anyone got the function in UltraWinGrid to programatically add a summary by column ? I would like to have the sum of amount ($) under each group.
Split into its own topic, please keep seach question on a separate topic so that they are easier to find later.
Sorry, didnât want to create too many topics about the same thing.
I have this so far:
private void Expand_All_Rows_in_WinGrid_Load()
{
myGrid = (EpiUltraGrid)csm.GetNativeControlReference("8dc6b497-02f3-4051-97c9-2299d46ab611");
myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
myGrid.DisplayLayout.Bands[0].SortedColumns.Add("GLAccount_GLAccount", false, true);
myGrid.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, myGrid.DisplayLayout.Bands[0].Columns["Calculated_Budget"]);
myGrid.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.InGroupByRows | SummaryDisplayAreas.BottomFixed | SummaryDisplayAreas.RootRowsFootersOnly;
myGrid.Rows.ExpandAll(true);
}
But it shows a grand total which is not what I want. I would like to programatically call the âShow Summariesâ function and then create a Sum Summary for my columns Calculated_Budget and Calculated_Amount
Edit: replaced my code with
private void Expand_All_Rows_in_WinGrid_Load()
{
myGrid = (EpiUltraGrid)csm.GetNativeControlReference(â8dc6b497-02f3-4051-97c9-2299d46ab611â);
myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
myGrid.DisplayLayout.Bands[0].SortedColumns.Add(âGLAccount_GLAccountâ, false, true);
myGrid.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, myGrid.DisplayLayout.Bands[0].Columns[âCalculated_Budgetâ]);
myGrid.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum, myGrid.DisplayLayout.Bands[0].Columns[âCalculated_Amountâ]);
myGrid.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.Default;
myGrid.Rows.ExpandAll(true);
}
It shows almost exactly like I want but it shows 2 lines of summariesâŚ
I just had this same thing happen. It is because the function you put this code inside is being called more than once. I solved it with a simple boolean flag like this:
private void edvV_ReadyToShip_2_1View_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
{
EpiUltraGrid myGrid = (EpiUltraGrid)csm.GetNativeControlReference("0c4673fe-dec2-407d-954e-6d60cdd7b850");
if (init == false)
{
myGrid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
myGrid.DisplayLayout.Bands[0].Summaries.Add(SummaryType.Sum,
myGrid.DisplayLayout.Bands[0].Columns["Calculated_ShipAmt"]);
myGrid.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.Default;
init = true;
}
ExpandRows(myGrid.Rows);
}
I initialized init as a false boolean up in the public class script. Thanks for sharing your code, it helped me out!