Validate Field Value Mapping

This tutorial explains how to build a Segment/Field rule validating that a field transformation is based on a mapping table.

In this example, we’ll validate that PID.8 (Administrative Sex) is transformed following this mapping table:

Code Standard Code
1 M
2 F
3 U
4 U


  1. Create an Excel file containing the mapping table as illustrated above
  2. Create a new suite variable
    • Select the root node in the suite tree (suite name)
    • Select the Variables tab on the right
    • Click Add…  A new row is added to the grid
    • Set the variable NAME to GenderMapping
    • Set the variable TYPE to Mapping Table
    • Set the generator type to Excel File
    • Enter the File and the Worksheet the table is in
  3. In the inbound HL7 task, select the Validation tab
  4. Select the Segment/Field Validation tab
  5. Add the rule: PID.13 is = ${GenderMapping[${CxLastOutboundMessage[%PID.8%]}]}


    This rule tells the application to:

    • Get initial PID.8 value (${CxLastOutboundMessage[%PID.8%]}):  PID.8 value of the message just sent
    • Get mapping value (${GenderMapping[…]}): Get the mapping value in the mapping table

    In other words, the validation rule loads the mapping table and returns the mapping value (M) for the initial PID.8 field (1).


Download the rules ( Field value mapping.cxf )

Learn more about how to import validation rules into an inbound HL7 task.