Set the value of a node

Added by iNTERFACEWARE

Use node.setNodeValue() to set the value of a leaf node, works for all node types

Source Code
   local Msg = hl7.message{vmd='demo.vmd', name='ADT'}
   
   -- NO BENEFIT: set the Time in the MSH segment
   Msg.MSH[7][1] = os.date('%Y%m%H%m')             -- works: assigns value to the child node
   Msg.MSH[7][1]:setNodeValue(os.date('%Y%m%H%m')) -- works: set the node value
   
   -- BENEFIT: if you decide to use a variable
   local MsgTime = Msg.MSH[7][1]
   MsgTime:setNodeValue(os.date('%Y%m%H%m'))       -- works: set the node value   
   MsgTime = os.date('%Y%m%H%m')                   -- fails: assigns the date to the variable (try it)
Description
Use node.setNodeValue() to set the value of a leaf node, works for all node types