Log In
[Expand]Welcome to DevExpress .NET Documentation
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
    [Collapse]Field Codes
    [Expand]Format Switches
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Spell Checking
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
   [Expand]Member Tables
    Keyboard Shortcuts
    HTML Tag Support
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Report Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation



Mixed field

{ IF Value-1 Operator Value-2 field-argument-1 field-argument-2 }

Compares the values designated by Value-1 and Value-2, using the operator designated by Operator. Value-1 and Value-2 can be literals or merge fields. For example, the field code

{IF {MERGEFIELD Order} >= 100 "Thanks" "The minimum order is 100 units" }

specifies that if the customer order is greater than or equal to 100 units, the result is "Thanks"; but if the customer order is fewer than 100 units, the result is "The minimum order is 100 units".

You can use the IF field with MERGEFIELD fields. The following statement illustrates this. If the current data record contains different values in HomeAddress and CompanyAddress fields, RichEditControl prints the value of the PresidentName field that is the first set of text in quotation marks. Otherwise, it prints the second set of text in quotation marks that is the value of the OwnerName field.

{ IF {MERGEFIELD CompanyAddress} <> {MERGEFIELD HomeAddress} "{MERGEFIELD PresidentName}" "{MERGEFIELD OwnerName}" }


Do not use the IF field in headers or footers if the condition is based on the PAGE and NUMPAGES field values. The field value can be incorrect due to limitations of the current layout calculation.

Is this topic helpful?​​​​​​​