Announcement

Collapse
No announcement yet.

TypeError:Cannot read property

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TypeError:Cannot read property

    Hi all

    I have an HL7 message I am converting to XML but it keeps giving me an error of "TypeError: Cannot read property "2" from undefined.

    The message is:
    Code:
    MSH|^~\&|medavis RIS|MEDAVIS|Mirth|Mirth|20190218123501||DFT^P03^DFT_P03|304928|P|2.5|||AL|NE||8859/1
    SFT|medavis
    EVN|P03|20190218123501|||2^medavis^GmbH^^^^^^^^^^PN|20190218113459
    PID|1|16^^^MEDAVIS^PI|||TEST G4M Nachname^TEST 2^T^^MISS~NameOfBirth^^^^^^B|00MemberCode|19921106|M|||MANNING ROAD^Ext.Add.Line^DURBAN^^4001^ZA||0313017352~072363395^^CP~^NET^Internet^[email protected]|0313017352~072363395^^CP~^NET^Internet^[email protected]|||||123456PatDepCode|||||||ZA||||N
    PV1|1|O||||||0020222^MAHOMED^N^N^^DR^^^MEDAVIS~N MAHOMED^MAHOMED^N^N^^^^^SEAL^^^^DN|||||||||||16766^^^MEDAVIS^VN|||||PRIVATE
    FT1|1|53||20190218123400||2|100884001^STENT PERIPHERAL VASCULAR E LU^med-mat|||1||piece
    ORC|RE||||IP||1^once^^20190218123400^20190218123400^R|||2^medavis^GmbH^^^^^^^^^^PN||125^MAHOMED^N^N^^DR
    OBR|1|||00110^X-ray skeletal survey under five years^MEDAVIS^00110^X-ray skeletal survey under five years^MEDAVIS|||20190218123400|20190218123400||||||||125^MAHOMED^N^N^^DR||U-ID24523|Bone Densitometer|||||US|I||1^once^^20190218123400^20190218123400^1|||WALK||2&medavis&GmbH&&&&&&MEDAVIS|2&medavis&GmbH&&&&&&MEDAVIS|2&medavis&GmbH&&&&&&MEDAVIS||20190218230500||||||N|^^^^Bone Dens
    NTE||||EXAM-DESCRIPTION
    NTE|2||18.02.2019|CASE-DESCRIPTION
    IN1|1||S3189^^^^NII~^^^^NIIP||||||Patient||||||02|TEST5^TEST5||19871005|MANNING ROAD||||||||||||||||||^TP||||||||||||920516
    ZF1||||20190218123300|||Krankheit|||||||||||||||1|||||||^N MAHOMED||1^^^^^^^^^^,  , 
    ZPV||||||||||||||||||||||||||||||||999999999999MemberID
    and the code parsing this section is:
    Code:
    for (var i=0;i<msg['PID']['PID.13'].length();i++)
         {
         	var commtype = msg['PID']['PID.13'][i]['PID.13.3'].toString()
         	if ( commtype=='CP')
        	{
         		tmp['Patient']['CellPhone'] = msg['PID']['PID.13'][i]['PID.13.1'].toString();
         	}
         	if ( commtype=='')
         	{
         		tmp['Patient']['TelephoneNumber'] = msg['PID']['PID.13'][i]['PID.13.1'].toString();
         	}
         	if ( commtype=='Internet')
         	{
         		tmp['Patient']['EMailAddress'] = ['PID']['PID.13'][i]['PID.13.4'].toString();
         	}     	
         }
    I have used this message for the template, so the both the template and messagetree contain the segment. I just cannot find why it is not working

  • #2
    Problem solved...

    Sigh, just an idiotic typing error that I left msg off in front of the field...

    Comment


    • #3
      Those are the hardest to catch because it looks correct.

      Comment

      Working...
      X