Mark Franssen · Oct 29

HL7 filter out messages that has specific tekst in PID segment

I am relativly new to this, so excuse me if i am asking a dumb question

HL7 schema is 2.4

When a HL7 message comes in and in the PID segment on spot 4 the word "Relation" is written, i want to filter out those messages through a Router Rule.

I have come up with several rules (when conditions), here are some examples.

HL7.{PID:4} CONTAINS "Relation"


HL7.{PID:AlternatePatientIDPID(1).ID} CONTAINS "Relation"

I have tried a lot of different Rules, but no luck yet.

But every time i test a massege what contains the word Relation in de PID segment on spot 4 it states " whens matched...."



What am i doing wrong??



Product version: HealthShare 2020.1
1 0 6 73
Log in or sign up to continue


I would double check the spelling as your question and code snippet have different values e.g. "Relation" vs "Relatie".  Generally, I would create and call a custom ObjectScript function to accomplish what you are looking to do as that would allow you greater flexibility and greater control as well in my opinion.



Thanx, but the spelling is correct, i only translated the word into English, should'nt have done that. 

On the other hand, now you know the Dutch word for Relation. wink

I don't know the sollution you suggest (Objectscript), i will dive into this and see what i can learn.

Any tips on how to begin whit that?

Someone who knows what i am doing wrong in this Rule?

CONTAINS wraps ObjectScript $FIND()  and just checks raw characters.
So no code conversion or Upper/Lower or anything else happens.
dump the value you expect into a TRACE message and see what it really is

When i do this, it works fine
HL7.RawContent CONTAINS "Relatie"

But there maybe other fields that can contain this word, so i want to narrow it down to the PID segment place 4.

This says that the first part was wrong initally:  "HL7.{PID:AlternatePatientIDPID(1).ID}"

So how do i check on the PID segment, place 4?

If this "HL7.{PID:AlternatePatientIDPID(1).ID}"  just doesn't exist CONTAINS must fail.
You could put your HL7 messages as input to a dummy DataTransformation to see
the available parts and their addressing and then apply it here


It works now, thanx everyone:

I now have "HL7.{PID:4.1} Contains "Relatie"" filled in the rule.

When testing i used the wrong Doctype apparantly, i should use: 2.4:ADT_A01

Probably the condition i posted in the beginning should have worked to, but this one is more simple to read and use.