iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Python Scripting Examples > Message Manipulation > Adding Empty Fields to a Generated Segment |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
Some HL7 applications may require a specified number of fields to always be provided for a particular segment, even if these fields are empty. If you are using Chameleon to generate HL7 messages for such an application, you can use a simple Python script to generate the empty fields. For example, suppose that you are generating the IN1 (Insurance) segment from the following table: In this table, fields 2-5, 8 and 16 are specified. Normally, this means that Chameleon generates an IN1 segment in which the first 16 fields are included:
Now, suppose that you want your IN1 segment to always contain at least the first 36 fields. To do this, define the following Segment Outbound script for field 36 of the IN1 segment:
This assigns the empty string to value, which is the predefined variable that specifies the value of a field in a segment. Because field 36 is now defined, the generated IN1 segment now includes all fields up to and including field 36:
|