Calculate GroupSummary Value programmatically in D

2019-07-20 20:35发布

问题:

In my code; I calculate 3 GroupSummary value with ASPxGridview;

<dx:ASPxSummaryItem FieldName="RISK_EUR" SummaryType="SUM" ShowInGroupFooterColumn="RISK_EUR" DisplayFormat="n0" />
<dx:ASPxSummaryItem FieldName="IPOTEK" SummaryType="AVERAGE" ShowInGroupFooterColumn="IPOTEK" DisplayFormat="n0" />
<dx:ASPxSummaryItem FieldName="MV_BERND" SummaryType="SUM" ShowInGroupFooterColumn="MV_BERND" DisplayFormat="n0" />

When i grouping, I want calculate another column's GroupSummary value like;

 GroupSummary[RISK_EUR] - GroupSummary[IPOTEK] - GroupSummary[MV_BERND]

How?

NOTE: I can't calculate this value calculating for every row and then total them, because this 3 GroupSummary's SummaryType isn't same. (One is AVERAGE)

回答1:

This can be implemented by using custom summary. When you adjust it, the grid will raise the CustomSummaryCalculate event for every record in every group. To distinguish between groups, the event arguments class provides the SummaryProcess property. So, you should use this event handler to manually calculate GroupSummary[RISK_EUR], GroupSummary[IPOTEK] and GroupSummary[MV_BERND] values. Using them, you will be able to calculate the resulting summary value.