none
How do I select Party ID using for each loop? RRS feed

  • Question

  • I have a xml document that I am using for each to loop through parties. I need to get partyID and date of birth. I am getting partyID but date of birth is showing 0001-01-01T00:00:00.

    XML Document

    <Integration>
    	<Case>
    		<CaseEvent Date="06/14/2010" ID="252945068">
    			<PartyID>9919636</PartyID>
    		</CaseEvent>
    		<CaseParty ID="9919636">
    			<DateOfBirth>04/27/1910</DateOfBirth>
    		</CaseParty>
    	</Case>
    	<IntegrationConditions>
    		<IntegrationCondition Word="TAWQ" Description="Inserts">
    			<NotificationEvent notificationType="TAWQ" elementKey="252945068">InsertSomething</NotificationEvent>
    		</IntegrationCondition>
    	</IntegrationConditions>
    </Integration>

    Result which is not showing DateOfBirth

    <InsertPWBRorAOS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="">
    <RelatedParties>
    <CaseParty>
    <DateOfBirth>0001-01-01T00:00:00</DateOfBirth>
    <PartyId>9919636</PartyId>
    </CaseParty>
    </RelatedParties>
    </InsertPWBRorAOS>

    Expected result

    <InsertPWBRorAOS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="">
    	<RelatedParties>
    		<CaseParty>
    			<DateOfBirth>04/27/1910</DateOfBirth>
    			<PartyId>9919636</PartyId>
    		</CaseParty>
    	</RelatedParties>
    </InsertPWBRorAOS>

    VB.Net code

    Public Shared Sub ProcessInsertPWBRorAOS(ByRef aobjXmlInputDoc As System.Xml.XmlDocument, ByVal aobjxmlNotificationEventNode As XmlNode)
    Dim objInsertPWBRorAOS As MMGService.InsertPWBRorAOS = New MMGService.InsertPWBRorAOS
    Dim objCaseParty As MMGService.CaseParty
    Dim objxmlEventPartyIDNode As XmlNode
    Dim strEventId As String
    strEventId = aobjxmlNotificationEventNode.SelectSingleNode("@elementKey").InnerText
    
    objCaseParty = New MMGService.CaseParty()
    'Loop through all PartyIDNodes in CaseEvent with ID equal to NotificationEvent's elementKey 
    For Each objxmlEventPartyIDNode In aobjXmlInputDoc.DocumentElement.SelectNodes("Case/CaseEvent[@ID=" + strEventId + "]/PartyID")
    	strPartyID = objxmlEventPartyIDNode.InnerText
        objCaseParty.PartyId = strPartyID
        'DateofBirth
        objCaseParty.DateOfBirth = dtmDateOfBirth
        objInsertPWBRorAOS.RelatedParties(i) = objCaseParty
        i += 1
    Next
    End Sub

    Monday, July 15, 2019 5:13 PM