In this scenario, the goal is to extract a field value (PatientID) from an HL7 message, modify the value, and set the result as a property on the message. This is a common use of the JavaScript filter if Rhapsody is used to output files to a Directory communication point, and those files need to have specific names based, in part, on the message itself.

The following screenshot illustrates the configuration of the JavaScript filter:

  • getField() is used above to pull the value from the message's PID.PatientID field.
  • setProperty() then takes two parameters; the property to be specified, and the value to be set. In the above case, the value is the patient id concatenated to a piece of hard-coded text.
  • An HL7 message definition must be present in the Route Properties of that particular route for field and property methods to work.
  • The fileName property, does not have to be declared elsewhere first.
  • JavaScript is case-sensitive