iNTERFACEWARE Products Manual > Installing and Using Chameleon > Using Python Scripting > Chameleon Python API > Environment Variable > Environment Variable Functions |
|
Looking for Iguana v.5 or v.6? Learn More or see the Help Center.
The functions defined for this object are listed in the table below:
The delimiter character returned by delimiter_char() depends on the message delimiter characters that are defined for the VMD file. To view these message delimiter characters, click Options in the Chameleon Toolbar. In the Options window that appears, click the Message Delimiters tab: The table at the bottom left lists the message delimiter characters that have been defined for this VMD file. Each row of the table specifies a delimiter level, and the Character column specifies the delimiter character that has been specified for that level. For HL7 messages, as shown above, the level 1 delimiter indicates the end of one segment and the start of another. The delimiter character for level 1 is 0x0D (carriage return). In this case, calling delimiter_char(0) returns the carriage return character. In HL7 messages, the level 2 character is the field delimiter character. By default, this is |. Calling delimiter_char(1) returns this delimiter character. Similarly, the level 3 and level 4 characters, ^ and &, delimit subfields and sub-subfields. These can be retrieved by calling delimiter_char(2) and delimiter_char(3). For other types of messages, the various levels of message delimiter may have a different purpose and may be different characters. However, for all message types, delimiter_char(x) returns the delimiter for level x plus 1.
The set_delimiter_char(x, value) function sets the delimiter for level x plus 1 to value. For example, the function call set_delimiter_char(1,"#") sets the Level 2 delimiter to #. set_delimiter_char() is useful when processing messages in X12 format, as the X12 standard specifies that the delimiters for an incoming X12 message are to be found at specific locations in the incoming message. The following Global Inbound Script sets the delimiter characters for an incoming X12 message:
This code indicates that the segment terminator (the level 1 delimiter) is to be found at byte 106 of the incoming message, which is stored in the value variable. (Recall that, in Python, character strings are indexed from 0, so byte 106 is at index 105.) Similarly, the data element separator (the level 2 delimiter) is found at byte 4 of the message, and the component element separator (the level 3 delimiter) is at byte 105. Since each incoming X12 message may define its own set of delimiter characters, this Global Inbound Script ensures that every message is processed properly.
|