In a config modifier schema, use this keyword to store a named value from a property or object that can be accessed later. This is beneficial in two use cases:
- You need to use the same property multiple times throughout the schema.
- You need to parse a different path before comparing or evaluating against the original property or value.
To access the stored value, you must include the use keyword as a sub-keyword to references. Learn about the use keyword.
This keyword executes at the following nesting level:
- omit
- constant
- references
- use
- get
- properties or if or concat or switch or pipe or merge
- default
- plugin
This example demonstrates the first use case for references: You need to use the same property multiple times throughout the schema.
For example, you can map PATIENT[0].PID.18.1 to the resource ID for FHIR® Appointment.
First, we check that identifier.value exists before setting its value.
During processing, the request checks if PID.18.1 exists in the initial payload. If so, the then action executes, meaning that PID.18.1 is set to the contact serial number (CSN). If PID.18.1 doesn’t exist, the else action executes, meaning that the original value is returned.
This example demonstrates the first use case for references: You need to parse a different path before comparing or evaluating against the original property or value. For this use case, a references keyword is commonly used when looping through arrays to track the current index being processed.
For example, you can covert every OBX.1 (set ID) from a number into a string. Since OBX.1 represents the Set ID, you can use this value to identify which specific observation to modify. You need references to:
- Get the current OBX index from this loop.
- Use that index to match against the correct observation record.
Redox has a predefined @parent variable that can be used to get the parent object or array of a property. See a references example with @parent.