Back to Devexpress

ProcessDuplicatesTarget Enum

xtrareports-devexpress-dot-xtrareports-dot-ui-d4761971.md

latest7.2 KB
Original Source

ProcessDuplicatesTarget Enum

Lists control characteristics whose duplicate values are processed.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public enum ProcessDuplicatesTarget
vb
Public Enum ProcessDuplicatesTarget

Members

NameDescription
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:

Remarks

The following code illustrates two cases:

  • Controls bound to the same column with duplicate column values.
  • Controls bound to the same column with duplicate values stored in the Tag property.

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:

csharp
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();
            }
        }
}
vb
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

DevExpress.XtraReports.UI Namespace