Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2325
calc'ing column summary... differences.....why?
posted

In my InitializeLayout event I set up some summaries as follows

            band.Override.SummaryDisplayArea = SummaryDisplayAreas.BottomFixed;           

            band.Summaries.Add("rawCost", "sum([RawCost])");           


This doesnt work.  No summary values get displayed.... however if I do the following....

            band.Summaries.Add("rawCost",SummaryType.Sum, band.Columns["RawCost"]);

This works and displays the sum for the column raw cost. Placing the display under the RawCost column.   I dont want this I want summaries displayed under the first column as such...:

Raw  Cost:  $5678

Final Cost:  $67890

...etc...

Why does the sum([RawCost]) not work and doing SummaryType.Sum does?  Don't they both do the same thing?

  • 29065
    Suggested Answer
    Offline posted

    Hello,

    I attached a sample on how to reposition the the displayed summary to located underneath a different column. This can be specified in the Add method you are using.

     

    // Add a summary and set the summary position to UseSummaryPositionColumn so that it shows up under a specified summary position column of the same band

    SummarySettings summary = band.Summaries.Add(SummaryType.Sum, null, band.Columns["OptionID"], SummaryPosition.UseSummaryPositionColumn, band.Columns["Employee"]);

    //Which would result in the sum of cells for OptionID would be displayed underneath the Employee column.

     

     

    SummarySettingsTest.zip
  • 469350
    Verified Answer
    Offline posted

    The first method uses a formula and the second method uses the built-in summary functionality of the grid. So the first method will fail to produce a result if you do not have an UltraCalcManager on the form to support formulas. It also might fail in rare cases if, for some reason) your grid is not hooked up to the CalcManager.