The following section of code reads two nodes from an XML file. Each node should be an array of up to 14 items. Some of the items may be blank. One node contains monthly payment amounts and the other node contains the dates that the payments are due on. The section of code I'm having trouble with is a function designed to check the data and verify that there is an equal number of payments and dates (i.e. if there are 10 scheduled payment dates in the payment date node, there should be a corrosponding 10 payments in the payment node). The function should compare each unit of the array in the payment node with the payment date node and makes sure that if one is blank or empty that the other one is empty and should assign an error value if one node has something and the other one doesn't. But it's not setting my error flag. Code is below
CODE
Func _PaymentAndDateError($PaymentNode, $PaymentDueDateNode);--------
Local $NumOfPayments, $NumOfScheduledDates
Local $EqualError = 0
$NumOfPayments = _XMLGetValue($PaymentNode)
$NumOfScheduledDates = _XMLGetValue($PaymentDueDateNode)
If IsArray ($NumOfPayments) And IsArray ($NumOfScheduledDates) Then
For $T = 1 to 14
MsgBox(0, "Debug", "$NumOfPayments[" & $T & "] = " & $NumOfPayments[$T] & "$NumOfScheduledDates[" & $T & "] = " & $NumOfScheduledDates[$T]); debug msgbox
MsgBox(0, "EqualError", "$EqualError = " & $EqualError); debug msgbox
If (($NumOfPayments[$T] = "") And ($NumOfScheduledDates[$T] <> "")) Then ; this is where i'm having the trouble....it should check this and then assign $EqualError to 1 if one has something in it and the other one doesn't....but it's not.
$EqualError = 1
Return $EqualError
EndIf
Next
Return $EqualError
Else
SetError(1,3,0)
EndIf
EndFunc; _CheckNumofPaymentsAndDates----------------------------------
Any help would be appreciated!