Hi
I would like to create a new message of a particular type and append various segments programmatically. I have started with the following snippet. What I am currently finding difficult is to define a segment of a particular segment structure. I would like to append a pid segment of 2.3.1 to my message. I know I could you the importfromstring but I wanted to know whether there was a better way of achieving this.
Set tOutputMessage = ##class(EnsLib.HL7.Message).%New()
Set target.DocType="2.3.1:DFT_P03"
#Dim tPID As EnsLib.HL7.Segment
s tPID.SegTypeName ="PID"
Any help would be much