Sidebar

How can I create multiple IN1 segments when creating an HL7 message from a CSV?

0 votes
861 views
asked Jun 30, 2017 by scott-b-8720 (560 points)
Here is some sample code.  Adding the first insurance company works fine, but when i try to add the second i get an error.

   message.setNode("IN1-1", '1');
   message.setNode("IN1-4", insName);    //    NAME_OF_INSURANCE_COMPANY

...

   message.setNode("IN1[2]-1", '2');
   message.setNode("IN1[2]-4", insName2);    //    NAME_OF_INSURANCE_COMPANY2

The error i get is this: WrappedException: Wrapped com.qvera.qie.web.exception.MessageModelException: Node not found: IN1[2]-1

2 Answers

0 votes
 
Best answer

You can do an addChild before the next IN1 segment.

message.addChild('/', 'IN1');

message.setNode("IN1[2]-1", '2');
message.setNode("IN1[2]-4", insName2);    //    NAME_OF_INSURANCE_COMPANY2

answered Jun 30, 2017 by michael-h-5027 (14,350 points)
selected Jun 30, 2017 by scott-b-8720
0 votes

Use this following code:

message.setNode("IN1-1", '1');
message.setNode("IN1-4", 'insName');    //    NAME_OF_INSURANCE_COMPANY

message.setNode("IN1-1", 2, 2);
message.setNode("IN1-4", insName2, 2);    //    NAME_OF_INSURANCE_COMPANY2

answered Jun 30, 2017 by brandon-w-8204 (33,270 points)
...