Please enable JavaScript to view this site.

HL7 C# Script Reference

 

The CHS_Segment class is the object representation of a HL7 segment (MSH, PID, OBX, etc). The HL7 Message (CHS_Message) is made up of CHS_Segments which are made up of CHS_Fields.

 

This class implements the COREException class for your convenience.     

 

See Also: CHS_Message, CHS_Field, COREHL7Script.

 

 

 


 

Public Properties:

 

Property Name

Data Type

Connected

bool (read only) - Will be false if the object is a disconnected segment or true if it is.

FieldCount

int (read only) - Will be the number of CHS_Field objects contained in the segment. Can change as you set new field values.

PareentMessage

CHS_Message - Will be a reference to the HL7 message object (CHS_Message) used to create the segment.

SegmentIndex

int (read only) - Will be the 1 based ordinal position of the segment object within the HL7 Message. The MSH segment will always be 1. Disconnected Segments will have a SegmentIndex of 0.

SegmentName

string (read only) -Will be the 3 character segment name of the segment object (MSH, PID, OBX, etc)

 

Public Methods:

 

Method

Return Value

AllFields()

CHS_Field[] - Returns an array of CHS_Field objects in the segment.

 

Clone()

CHS_Segment - Creates a disconnected CHS_Segment which is an exact copy of the source segment. Add to the parent message using CHS_Message.AddNewSegment()

GetFieldNumber(int index)

CHS_Field - Retrieves the CHS_Field object at position index (1 based, index 0 is the SegmentName). If index is less than 1 or greater than FieldCount will return null. See GetFieldToEdit()

GetFieldToEdit(int index)

CHS_Field - Retrieves the CHS_Field object at position index (1 based, index 0 is the SegmentName) if index is greater than FieldCount CHS_Field(s) are added to extend the number of fields. If index is less than 1 will return null.

GetFieldValue

(

int fieldnumber,

int componentnumber = 1

)

string - Returns the string value of the CHS_Field object at position fieldnumber, component componentnumber. If fieldnumber is greater than FieldCount returns an empty string. If componentnumber is greater than the number of components in the CHS_Field object returns an empty string.

GetFieldValue

(

int fieldnumber,

int componentnumber,

int subcomponent = 1,

int repeatindex = 1

)

string - Returns the string value of the CHS_Field object at position fieldnumber, component componentnumber, subComponent number subcomponent, and the repeat instance repeatindex. If fieldnumber is greater than FieldCount returns an empty string. If componentnumber is greater than the number of components in the CHS_Field object returns an empty string. If subcomponent is greater than the number of subComponents within HL7 field component componentnumber returns an empty string. If repeatindex is greater than the number of repeat instances in the CHS_Field returns an empty string.

GetChildSegmentsNamed

(

string segmentname,

string[] segmentToIgnore = null

)

List<CHS_Segment> returns a List accumulation of all CHS_Segments which appear in ParentMessage AFTER the current object with the SegmentName equal to segmentname. It will STOP building the List if it encounters a CHS_Segment with SegmentName equal to the current object UNLESS that SegmentName is in the string array segmentsToIgnore. If none are found returns an EMPTY List<CHS_Segment>.

GetChildSegmentsNamed

(

string[] segmentnames,

string[] segmentToIgnore = null

)

List<CHS_Segment> returns a List accumulation of all CHS_Segments which appear in ParentMessage AFTER the current object with the SegmentName contained in the string array segmentnames. It will STOP building the List if it encounters a CHS_Segment with SegmentName equal to the current object UNLESS that SegmentName is in the string array segmentsToIgnore. If none are found returns an EMPTY List<CHS_Segment>.

 

 

GetParentSegment(string segmentName)

CHS_Segment - Returns the first CHS_Segment in the message BEFORE the current object with the Segment Name segmentName or null if one does not exist.

GetRawFieldValue(int fieldnumber)

string - Returns the full HL7 value of value of the CHS_Field object at position fieldnumber. If fieldnumber is < 1 or > FieldCount will return an empty string.

NextSegment()

CHS_Segment - Returns the first CHS_Segment in the message AFTER the current object. Will be null if the current object is the last segment.

PreviousSegment()

CHS_Segment - Returns the first CHS_Segment in the message BEFORE the current object. Will be null if the current object is the first segment (the MSH segment).

SegmentValue()

string- Returns the current string value of the current CHS_Segment object.

ToString()

string- Identical to SegmentValue().

TrimFieldsTo(int newFieldCount)

void- Removes CHS_Field objects from your CHS_Segment object until FieldCount is equal to newFieldCount.

 


 

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC