-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
I have this PID segment:
PID|1|124553|124553^^^TEST^PI~~~||JOHN^DOE|
If i use this code to get the name it works:
req.msg.getSegment('PID').getComponent(5, 1)
If i use this code to get the text "TEST", i get an empty string:
req.msg.getSegment('PID').getComponent(3, 4)
If i then remove the ~ repetition separator, then it works!
I can re-parse the message manually, but i prefer a more "elegant" solution.
const field = req.msg.getSegment('PID').getField(3, 1);
const reparse = new hl7.Parser().parseField(field);
console.log(reparse.value[0][3].toString());
Is there a bug about this, or am i wrong in something?
EDIT:
I think you can just check if you have repetition in the field adding something like this in the getComponent function.
if(components.value) components = components.value[0]; // HERE I CHECK IF I HAVE REPETITIONS
Metadata
Metadata
Assignees
Labels
No labels