In a config modifier schema, use prefer to specify which value to return when evaluating an array of property definitions. If the specified prefer value exists, it's returned, otherwise the next property is evaluated.
This is useful for common situations when there are multiple possible fields from the input that might be relevant to the output, and you want to choose the “best” from that list.
This keyword executes at the following nesting level:
- omit
- constant
- references
- use
- get
- properties or if or concat or switch or pipe or merge or prefer or items
- default
- plugin
You’re receiving an ADT^02 message where Visit.VisitDateTime is normally mapped from PV1.44.1 but is sometimes null or doesn't exist. But you still want a value for Visit.VisitDateTime to map from PV2.8.1. This is a perfect usage for prefer where if our first choice is null, it falls back on the second, third, or N choice.
Based on this example config modifier schema, this is the output.