                Dim loadResponse As LoadCollectionResponseData

                Dim strFilter As String

 

                strFilter = String.Format("JournalId = '{0}' AND BatchStatus = 'P'", journalID)

                loadResponse = Me.IDOClient.LoadCollection("ILC_JournalBatches", "BatchStatus,BatchId", strFilter, String.Empty, 0)

 

                Dim count As Integer = loadResponse.Items.Count

                If count > 0 Then

 

                    For i As Integer = 0 To count - 1

 

                        Dim batchID As Integer = loadResponse(i, "BatchId").GetValue(Of Integer)()

 

                        Dim updateRequest As UpdateCollectionRequestData

                        Dim updateResponse As UpdateCollectionResponseData

                        Dim item As IDOUpdateItem

 

                        ' Create the update request

                        updateRequest = New UpdateCollectionRequestData("ILC_JournalBatches")

 

                        ' Create the item to update

                        ' Update request must include the _ItemId property, or the RecordDate and RowPointer properties.

                        item = New IDOUpdateItem(UpdateAction.Update, loadResponse.Items(i).ItemID)

 

                        ' Set the key fields to identify the record

                        item.Properties.Add("JournalId", journalID, False)

                        item.Properties.Add("BatchId", batchID, False)

 

                        ' Set the field(s) to update

                        item.Properties.Add("BatchStatus", "A", True)

 

                        ' Add the item to the request

                        updateRequest.Items.Add(item)

 

                        ' Execute the update

                        updateResponse = IDOClient.UpdateCollection(updateRequest)

                    Next i

                End If			 