Check if a node is empty (null)

Verified
Added by iNTERFACEWARE

Use node.isNull() to check if a node is null (not present), works for all node types

Source Code
   local Msg, Name = hl7.parse{vmd='example/demo.vmd', data=Data}

   -- test if the patient birth time is missing
   local isleaf = Msg.PID[7][1]:isNull()
   --> false
   
   -- test if the the patient initials are missing
   local isleaf = Msg.PID[5][1][3]:isNull()
   --> true
Description
Use node.isNull() to check if a node is null (not present), works for all node types
Usage Details

Use node.isNull() to check if a node is null (not present).

Note: The node.isNull() function works with all types of node trees.

How to use the snippet:

  • Paste the code into your script