Here is my code that I am using to populate my xml file with data from my database for the bank transactions. In each distribution array a blank node is being placed
Dim intBatchEntries As Integer = 0
Dim intTransactionTypeCount As Integer = GetBankRecNumberLines()
Dim intTransactionCount As Integer = 0
Dim intRowcount As Integer = pubset.Tables(0).Rows.Count
'create array of journal entries
Dim bankRecDist() As taBRBankTransactionDist_ItemsTaBRBankTransactionDist
Try
'populate xml files
For i As Integer = 0 To intRowcount - 1
'retrieve data from dataset
strChekBkId = Convert.ToString(pubset.Tables(0).Rows(i)("checkbookid"))
strCmTrxNum = Convert.ToString(pubset.Tables(0).Rows(i)("CmTrxNum"))
strTrxAmt = Convert.ToString(pubset.Tables(0).Rows(i)("journalamount"))
strBachNumb = Convert.ToString(pubset.Tables(0).Rows(i)("mgpbatchnumber"))
strTrxDate = Convert.ToString(pubset.Tables(0).Rows(i)("d_transdate"))
strJournalNumber = Convert.ToString(pubset.Tables(0).Rows(i)("i_sourcebatchid"))
'create BRBankTransactionType
Dim bankRecType As New BRBankTransactionType
'get the number of entries for a new sourcebatchid
If Not strJournalNumberHold = strJournalNumber Then
Dim intBatchCount As Integer = 0
intBatchEntries = GetNumberEntries(strJournalNumber, pubset)
ReDim bankRecDist(intBatchEntries)
Console.WriteLine("intbatchentries")
Console.WriteLine(intBatchEntries)
'create header
Dim bankRecHeader As New taBRBankTransactionHeader
'bank header
With bankRecHeader
.Option = 1
.CHEKBKID = strChekBkId
.CMTrxNum = strCmTrxNum
.TRXAMNT = strTrxAmt
.CMTrxType = 5
.DSCRIPTN = strCmTrxNum
.BACHNUMB = strBachNumb
.TRXDATE = strTrxDate
End With
'assign header
bankRecType.taBRBankTransactionHeader = bankRecHeader
Dim intTest As Integer = i + (intBatchEntries - 1)
Console.WriteLine("intTest")
Console.WriteLine(intTest)
'create journal entries
For batchEntry As Integer = i To intTest
'initialize variables
strActNumSt = Convert.ToString(pubset.Tables(0).Rows(batchEntry)("AgentReceivableGLNumber"))
debit = Convert.ToString(pubset.Tables(0).Rows(batchEntry)("Y_DEBITBALANCE"))
'add journal line
Dim bankRecDistLine As New taBRBankTransactionDist_ItemsTaBRBankTransactionDist
With bankRecDistLine
.Option = 1.0
.ACTNUMST = strActNumSt
.DEBITAMT = debit
.DistRef = strCmTrxNum
End With
'add journal entry
bankRecDist(intBatchCount) = bankRecDistLine
'increase journal line count
intBatchCount += 1
Console.WriteLine("batchentry")
Console.WriteLine(batchEntry)
Console.ReadLine()
Next
'place current source batch in the hold variable'
strJournalNumberHold = strJournalNumber
'assign the batchcount to the for counter variable to
'start at correct row in the dataset
i = i + intBatchEntries - 1
'assign journal transaction lines to the transaction type
bankRecType.taBRBankTransactionDist_Items = bankRecDist
'add transaction type to econnect
ReDim Preserve eConnect.BRBankTransactionType(intTransactionTypeCount)
eConnect.BRBankTransactionType(intTransactionCount) = bankRecType
intTransactionCount += 1
End If
Next
*This post is locked for comments