Create schema independent DTL to add FTS segment
I ike to create schema independent DTL to add FTS segment to the end of a message. The problem that I see if do I need to loop each segment to find the last segment ? Or is there a better way to do this?
ClassMethod Transform(source As %RegisteredObject, target As %RegisteredObject) As %Status
{
set target=source.%ConstructClone(1)
set FTSseg= "FTS||End Of File|"
ERROR
quit sc
}
Discussion (1)0
Comments
You can find the current segment count using field counting syntax:
source.GetValueAt("(*)")To create a new segment have a look at the documentation for EnsLib.HL7.Segment, particularly the method ImportFromString. To insert a segment into a message, have a look at EnsLib.HL7.Message::InsertSegmentAt.