GetValueEventArgs.Report Property
In This Article
Provides access to a report which owns the calculated field, for which the CalculatedField.GetValue event was raised.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
#Declaration
public XtraReport Report { get; }
#Property Value
Type | Description |
---|---|
Xtra |
An Xtra |
#Remarks
Use the Report property to get access to a report and any of its contents required for calculating a custom value for a calculated field.
#Example
The report created in this example is bound to the “Orders” table of the sample Northwind database.
To sort records by days of the week at runtime, do the following.
- Create a calculated field with the CalculatedField.FieldType property set to String. Add a GroupHeader band, and add a grouping criteria (with the GroupField.FieldName property set to the created calculated field) to its GroupHeaderBand.GroupFields collection.
- Then, drop the calculated field from the Field List onto the GroupHeader1 band for the XRLabel control (named hdrLabel) bound to the field to be automatically created.
- Handle the calculated field’s CalculatedField.GetValue and the hdrLabel‘s XRControl.BeforePrint event handlers in the following way.
using System;
using System.Data;
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
// ...
private void calculatedField1_GetValue(object sender, GetValueEventArgs e) {
object columnValue = e.GetColumnValue("OrderDate");
e.Value = (int)((DateTime)columnValue).DayOfWeek;
}
private void hdrLabel_BeforePrint(object sender, System.ComponentModel.EventArgs e) {
hdrLabel.Text = ((DayOfWeek)this.GetCurrentColumnValue(this.calculatedField1.Name)).ToString();
}
See Also