How to parse a custom message?

Discussion of open issues, suggestions and bugs regarding to (known as Delphi HL7) HL7 Components
Post Reply
xiang_1988
Posts: 17
Joined: Thu Jul 31, 2014 9:15 am

How to parse a custom message?

Post by xiang_1988 »

Hi,admin!
But I don't know how to parse a custom message.

procedure TForm1.Button12Click(Sender: TObject);
var
Msg: TdiZPI_Z01_24;
begin//use uCustom.pas
//MSH|^~\&|||||20140822231346||MFN^M01||P|2.4
//ZAU|||||||||ins carrier 5
//ZIN||con

try
Msg := TdiZPI_Z01_24.Create;
// Msg.EnableEscapedValues:=False;
Msg.AsString := Memo2.Text;
Memo1.Clear;
Memo1.Lines.Append(Msg.ZAU.inscarrier5.AsString);
Memo1.Lines.Append(Msg.ZIN.ifcondition.AsString);
finally
Msg.Free;
end;

This code can't parse customised message, could you tell me where is wrong?
xiang_1988
Posts: 17
Joined: Thu Jul 31, 2014 9:15 am

Re: How to parse a custom message?

Post by xiang_1988 »

How to parse a custom message??
Attachments
Red tag can't be resolved
Red tag can't be resolved
demo.jpg (75.55 KiB) Viewed 11931 times
mydemo.rar
(101.2 KiB) Downloaded 802 times
admin
Site Admin
Posts: 256
Joined: Sun Jun 05, 2011 8:06 pm

Re: How to parse a custom message?

Post by admin »

Hi,

TdiZPI_Z01_24 message defined as : (see uCustom.pas )

Code: Select all

{ TdiZPI_Z01_24 }

procedure TdiZPI_Z01_24.Init;
begin
  inherited;
   Name :='ZPI_Z01';
   MessageType :='ZPI';
   TriggerEvent :='Z01';
   HL7Version :='2.4';
   Definitions.Add('MSH',TdiMSH_24,1,1); 
   Definitions.Add('MSA',TdiMSA_24,1,1);
   Definitions.Add('ZAU',TdiZAU_24,1,1); 
   Definitions.Add('PRD',TdiPRD_24,1,1); 
   Definitions.Add('PID',TdiPID_24,0,1);
   Definitions.Add('IN1',TdiIN1_24,0,1);
   Definitions.Add('ZIN',TdiZIN_24,0,1);

   ParseHL7(InitMsg);
end;
In this definition
Definitions.Add('MSA',TdiMSA_24,1,1);
says for 'MSA' segment use TdiMSA_24 class and min: 1 max : 1
please change like this :
Definitions.Add('MSA',TdiMSA_24,0,1);

apply similar changes to not used other segments.

Best Regards.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests