XRSummary.Func Property
Specifies the arithmetic function to calculate.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
#Declaration
[DefaultValue(SummaryFunc.Sum)]
public virtual SummaryFunc Func { get; set; }
#Property Value
Type | Default | Description |
---|---|---|
Summary |
Sum | A Summary |
Available values:
Name | Description |
---|---|
Avg | Calculates the average of all the values within the specified summary region (group, page or report). |
Count | Counts the number of values within the specified summary region (group, page or report). |
Sum | Calculates the total of all the values within the specified summary region (group, page or report). |
Running |
Summarizes all the values, which were printed before the current data row, with the current data row’s value. |
Carryover |
Summarizes all the values before the current position and calculates the carried forward and brought forward totals. |
Percentage | Calculates the percent ratio of the current data row’s value to the total of all the values within the specified summary region (group, page or report). |
Max | Calculates the maximum of all the values within the specified summary region (group, page or report). |
Min | Calculates the minimum of all the values within the specified summary region (group, page or report). |
Median | Finds the middle number within a sequence. Note that if the total number of elements is odd, this function returns the value of a middle number in a sequence. If the total number of elements is even, this function returns the arithmetical mean of the two middle numbers. |
Var | Calculates the amount of variance for all the values within the specified summary region (group, page or report). |
Var |
Calculates the population variance of all the values within the specified summary region (group, page or report). |
Std |
Calculates the standard deviation of all the values within the specified summary region (group, page or report). |
Std |
Calculates the standard population deviation of all the values within the specified summary region (group, page or report). |
DAvg | Calculates the average of all the distinct values within the specified summary region (group, page or report). |
DCount | Counts the number of distinct values within the specified summary region (group, page or report). |
DSum | Calculates the total of all the distinct values within the specified summary region (group, page or report). |
DVar | Calculates the amount of variance for all the distinct values within the specified summary region (group, page or report). |
DVar |
Calculates the population variance of all the distinct values within the specified summary region (group, page or report). |
DStd |
Calculates the standard deviation of all the distinct values within the specified summary region (group, page or report). |
DStd |
Calculates the standard population deviation of all the distinct values within the specified summary region (group, page or report). |
Record |
Returns the current record number in the data source within the specified summary region (group, page or report). This means for instance, if the summary is calculated for a group, then the record number is calculated only within that group, and is reset every time a new group is started. |
Custom | Calculates the custom summary using the XRLabel. |
#Remarks
The report area, for which the specified arithmetic function is calculated (page, group, or report), is specified by the XRSummary.Running property.
#Example
The following example demonstrates how to set summary options for a label at runtime. The method below creates an XRSummary object, sets its properties, and sets the XRLabel.Summary property. This example assumes that there is an already existing XRLabel object, passed as a parameter and bound to a dataset field that contains a numerical value.
using DevExpress.XtraReports.UI;
// ...
public void SetFunction(XRLabel label) {
// Create an XRSummary object.
XRSummary summary = new XRSummary();
// Set a function which should be calculated.
summary.Func = SummaryFunc.Avg;
// Set a range for which the function should be calculated.
summary.Running = SummaryRunning.Group;
// Set the "ingore null values" option.
summary.IgnoreNullValues = true;
// Set the "treat strings as numerics" option.
summary.TreatStringsAsNumerics = true;
// Set the output string format.
summary.FormatString = "{0:c2}";
// Make the label calculate the specified function for the
// value specified by its DataBindings.Text property.
label.Summary = summary;
}
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Func property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.