if

Last updated: Feb 20, 2026
DEVELOPER
IMPLEMENTATION
HEALTH TECH VENDOR

Definition

In a config modifier schema, use if to define a conditional state to run a given action or not.

Exclusive keywords

If properties, if, concat, switch, pipe, merge, prefer, or items are present at the same nesting level, only the first keyword listed will run. We recommend not listing these keywords together at the same nesting level.

A conditional allows you to determine how to construct an output value by conditionally executing different keywords, based on the evaluation of a set of values.

You can use one of these sub-keywords to construct a conditional statement:

  • operator
  • terms
  • then
  • else

Order of execution

This keyword executes in the following order:

  1. omit
  2. constant
  3. references
  4. use
  5. get
  6. Mutually exclusive keywords at this level:
    • properties
    • if
    • concat
    • switch
    • pipe
    • merge
    • prefer
    • items
  7. default
  8. plugin

Sub-keywords

operator

Determines what action to take based on one of the following operators. The config modifier defines what should happen if a value exists and meets the criteria of any of these operators.

Definition of existence

We define existence of a value based on some rules. Specifically, these evaluations are defined as does not exist:

  • undefined
  • null
  • ''
  • []
  • NaN

We specifically treat some Falsy (learn about Falsy) values as exists:

  • false
  • 0
  • ' ' (empty string but padded with a space)

terms

Defines a sequential array of keywords to execute on. All terms are evaluated in sequence, then the related operator performs the appropriate action. You can review the requirements for terms based on the operator used.

Refer to a selector

Within the context of a terms keyword statement, you can use {} to retrieve a value at the already defined selector instead of repeating the same path. Learn about referring to a selector.

then / else

These keywords are used in conjunction with each other to define which action should happen when:

  • Execute the then action when the operator resolves to a true state.
  • Execute the else action when the operator resolves to a false state.

Example

For example, you could define which fields to use to build an object.

Example: Then / else input from initial payload
json
1
{
2
"Orders": [
3
{
4
"ApplicationOrderID": "844",
5
"ClinicalInfo": [],
6
"CollectionDateTime": "2025-05-29T14:59:00.000Z",
7
"Comments": null,
8
"Diagnoses": [
9
{
10
"Code": "Z13.71",
11
"Codeset": "ICD-10",
12
"DocumentedDateTime": null,
13
"Name": "Encounter for nonprocreative screening for genetic disease carrier status",
14
"Type": "Unknown"
15
}
16
],
17
...
18
"Procedure": {
19
"Code": "523",
20
"Codeset": "GDXEAP",
21
"Description": "GDX NEURO-NDD"
22
},
23
...
24
"Status": "Update",
25
"TransactionDateTime": "2025-05-29T14:59:25.000Z"
26
}
27
],
28
}
Example: Then / else selector
json
1
$.Orders[*].Procedure.Code
Example: Config modifier with then / else keywords
yaml
1
if:
2
operator: equals
3
terms:
4
- {}
5
- constant: '523'
6
then:
7
constant: '691'
8
else:
9
comment: pass original value

During processing, the request checks if the procedure code equals 523 in the initial payload. If so, the then action executes, meaning that the procedure code is set to 691. If the procedure code doesn’t equal 523, the else action executes, meaning that the original procedure code is passed.

Example: Then / else output
json
1
"Orders": [
2
{
3
"ApplicationOrderID": "844",
4
"ClinicalInfo": [],
5
"CollectionDateTime": "2025-05-29T14:59:00.000Z",
6
"Comments": null,
7
"Diagnoses": [
8
{
9
"Code": "Z13.71",
10
"Codeset": "ICD-10",
11
"DocumentedDateTime": null,
12
"Name": "Encounter for nonprocreative screening for genetic disease carrier status",
13
"Type": "Unknown"
14
}
15
],
16
...
17
"Procedure": {
18
"Code": "691",
19
"Codeset": "GDXEAP",
20
"Description": "GDX NEURO-NDD"
21
},
22
...
23
"Status": "Update",
24
"TransactionDateTime": "2025-05-29T14:59:25.000Z"
25
}
26
],

FHIR® is a registered trademark of Health Level Seven International (HL7) and is used with the permission of HL7. Use of this trademark does not constitute an endorsement of products/services by HL7®.