Invoke Code Error: "Invoke Code: Exception has been thrown by the target of an invocation."

Hey I am working on the attached .xaml Test6.xaml (7.4 KB).

I am having this errorerror1.txt (2.6 KB)

Kindly note the In Datatable has been successfully initialized separately(not present in the xaml)

Invoke code message:

Dim table As New DataTable
table.Columns.Add(“Agent ID”, GetType(String))
table.Columns.Add(“Fatal”, GetType(Integer))
table.Columns.Add(“Non-Fatal”, GetType(Integer))

Dim table2 As New DataTable
table2 = dt2.Select(“[Agency]=‘Airan’ AND [PrePostCol] =‘Post’ AND [Audit result] = ‘FAILED’ AND [Audit Date]=” + strAuditDate).CopyToDataTable

Dim table3 As New DataTable
table3 = table2.DefaultView.ToTable(True,“Agent ID”)

Dim row1 As DataRow
For Each row1 In table3.Rows
Dim strAgent As String
strAgent = row1.Item(0).ToString
Dim noOfFatal As Integer = 0
Dim noOfNonFatal As Integer = 0
For Each row2 As DataRow In table2.Rows
If(row1.Item(“Agent ID”) Is row2.Item(“Agent ID”)) Then
If(row2.Item(“Fatal/Non-Fatal Error”) Is “Fatal Error”) Then
noOfFatal = noOfFatal + 1
End If
If(row2.Item(“Fatal/Non-Fatal Error”) Is “Non-Fatal Error”) Then
noOfNonFatal = noOfNonFatal + 1
End If
End If
Next row2
table.Rows.Add( strAgent, noOfFatal, noOfNonFatal)
noOfFatal = 0
noOfNonFatal = 0
Next row1

out_table = table

Kindly help me with the error. Thanks in advance!

It would be a lot simpler to do all this with activities. That’s the point of activities.

Hi,

found the error is in this portion:

Dim table3 As New DataTable
table3 = table2.DefaultView.ToTable(True,“Agent ID”).

am I missing anything?