xtrareports-devexpress-dot-xtrareports-dot-ui-d4761971.md
Lists control characteristics whose duplicate values are processed.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public enum ProcessDuplicatesTarget
Public Enum ProcessDuplicatesTarget
| Name | Description |
|---|---|
Value |
The control’s field data values are considered when the report processes duplicate values.
|
| Tag |
The control’s Tag property values are considered when the report processes duplicate values.
|
The following properties accept/return ProcessDuplicatesTarget values:
The following code illustrates two cases:
Consider the second case in greater detail. Different report groups can have the same field values. If you wish to merge field values within a group, and not across groups, set the control’s ProcessDuplicatesTarget property to ProcessDuplicatesTarget.Tag and use an expression to calculate the control’s Tag property value. The expression should combine the current group field and the control’s data field, so that the Tag value is different for each group.
Use the control’s ProcessDuplicatesMode property to specify how to treat controls with duplicate characteristics. For more information specific to controls, refer to the following topics:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
namespace ProcessDuplicatesTarget
{
public partial class ProductReport : DevExpress.XtraReports.UI.XtraReport
{
public ProductReport()
{
InitializeComponent();
}
// Display duplicate values.
public void NoMerge()
{
this.ShowPreviewDialog();
}
// Merge duplicate values of the XRControl.Tag property.
public void MergeByTag()
{
ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Tag", "ToStr([SupplierID]) + '_' + ToStr([CategoryID])");
this.xrTableCell2.ExpressionBindings.Add(expressionBinding);
this.xrTableCell2.ProcessDuplicatesMode = ProcessDuplicatesMode.Merge;
this.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Tag;
this.ShowPreviewDialog();
}
// Merge duplicate values of a report control's data.
public void MergeByValue()
{
ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Text", "[CategoryName]");
this.xrTableCell2.ExpressionBindings.Add(expressionBinding);
this.xrTableCell2.ProcessDuplicatesMode = ProcessDuplicatesMode.Merge;
this.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Value;
this.ShowPreviewDialog();
}
}
}
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports DevExpress.XtraReports.UI
Namespace ProcessDuplicatesTarget
Partial Public Class ProductReport
Inherits DevExpress.XtraReports.UI.XtraReport
Public Sub New()
InitializeComponent()
End Sub
' Display duplicate values.
Public Sub NoMerge()
Me.ShowPreviewDialog()
End Sub
' Merge duplicate values of the XRControl.Tag property.
Public Sub MergeByTag()
Dim expressionBinding As New ExpressionBinding("BeforePrint", "Tag", "ToStr([SupplierID]) + '_' + ToStr([CategoryID])")
Me.xrTableCell2.ExpressionBindings.Add(expressionBinding)
Me.xrTableCell2.ProcessDuplicatesMode = ProcessDuplicatesMode.Merge
Me.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Tag
Me.ShowPreviewDialog()
End Sub
' Merge duplicate values of a report control's data.
Public Sub MergeByValue()
Dim expressionBinding As New ExpressionBinding("BeforePrint", "Text", "[CategoryName]")
Me.xrTableCell2.ExpressionBindings.Add(expressionBinding)
Me.xrTableCell2.ProcessDuplicatesMode = ProcessDuplicatesMode.Merge
Me.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Value
Me.ShowPreviewDialog()
End Sub
End Class
End Namespace
The results are shown below:
No Merge
ProcessDuplicatesTarget = Tag
ProcessDuplicatesTarget = Value
View Example: Reporting for WinForms - How to Vertically Merge Cells With Duplicate Values
If different report groups have the same field values and you wish to merge field values within individual groups, create an expression that has the same value for controls within a group and non similar values for controls in different groups. The expression should include a current group field and a field whose values you wish to merge. Set the ProcessDuplicatesTarget property to Tag and assign the created expression to the control’s Tag property.
See Also