Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
    Overview
   [Expand]Getting Started
   [Collapse]Fundamentals
    [Expand]RichEditControl
    [Expand]Document
     Supported Document Formats
    [Collapse]Fields
     [Collapse]Field Codes
       AUTHOR
       COMMENTS
       CREATEDATE
       DATE
       DOCPROPERTY
       DOCVARIABLE
       HYPERLINK
       IF
       INCLUDEPICTURE
       KEYWORDS
       LASTSAVEDBY
       MERGEFIELD
       NUMPAGES
       PAGE
       PRINTDATE
       REVNUM
       SAVEDATE
       SEQ
       SUBJECT
       SYMBOL
       TC
       TIME
       TITLE
       TOC
     [Expand]Format Switches
      Field Structure
      Inserting a Field
      Field Display Modes
      Updating a Field
      Field Types
     Commands
     Services
     Layout API
     Product Class Structure
     Default Keyboard Shortcuts
     Measure Units
     HTML Tag Interpretation
   [Expand]Concepts
   [Expand]Visual Elements
   [Expand]Examples
   [Expand]Member Tables
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [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]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

IF

IF

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}" }

Important

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.

How would you rate this topic?​​​​​​​