I'm parsing through an HL7 message containing multiple OBX segments. In some cases, the first OBX segment will only have an ID, but no other fields filled in. All of the other OBX segments will. What I can't seem to figure out is how to continue with the next OBX segment if a field is empty. Here is a snippet:
for each (obx in msg..OBX)
{
code = obx['OBX.3']['OBX.3.1'].text();
logger.info('Code was ' + code);
// move to next segment if no result
// doesn't work
if (obx['OBX.5']['OBX.5.1'] == null)
{
continue;
}
// no joy
if (obx['OBX.5']['OBX.5.1'].text() == null)
{
continue;
}
// no luck here either
if (obx['OBX.5']['OBX.5.1'].text() == "")
{
continue;
}
}
How can I move to the next OBX segment if a specific field in the current OBX segment is empty?
Thanks,
Vince
for each (obx in msg..OBX)
{
code = obx['OBX.3']['OBX.3.1'].text();
logger.info('Code was ' + code);
// move to next segment if no result
// doesn't work
if (obx['OBX.5']['OBX.5.1'] == null)
{
continue;
}
// no joy
if (obx['OBX.5']['OBX.5.1'].text() == null)
{
continue;
}
// no luck here either
if (obx['OBX.5']['OBX.5.1'].text() == "")
{
continue;
}
}
How can I move to the next OBX segment if a specific field in the current OBX segment is empty?
Thanks,
Vince
Comment