07-01-2024 09:15 AM
In a data connector rule, we need to run the api.Parser.ProcessDataTable funciton that can process a DataTable.
However, using SIC funciton, we have to get data from the source into a XFDataTable:
Dim xfDT As xfDataTable = Nothing
.
.
.
xfDT = New xfDataTable(si,objJobStatus.RemoteJobResult.ResultSet,Nothing,1000)
The XFDataTable is created and we can see that it has rows in it.
We convert the XFDataTable to a DataTable using:
Dim dt As datatable = xfdt.ConvertToDataTable(si)
When we run the new DataTable thorugh the ProcessDataTable, we get an error: "Data load Ado.Net DataTable is invalid or null."
When we try to count the rows on the DataTable, we get an error: "Object reference not set to an instance of an object"
Is there any information out there about the differences between a DataTable and a xfDataTable? Is there another way to convert a xfDataTable to a DataTable that will no result in errors?
07-01-2024 09:52 AM
Hi @Gidon_Albert,
Have you tried creating the dt as a New Datatable like this?
Dim dt As New DataTable()
dt = xfdt.ConvertToDataTable(si)
07-01-2024 10:45 AM
Thanks @FredLucas . Yes. Same error
07-02-2024 05:03 AM
Have you tried this:
Dim strTableNameAudit as String = "MyTable"
Dim dt As New DataTable(strTableNameAudit)
dt = xfdt.ConvertToDataTable(si)
07-02-2024 08:49 AM
Not sure if this helps but I've done the following test on a extensibility rule and can tell you that it gives me the expected results:
Dim originalDT As Datatable = BRApi.Import.Data.FdxExecuteDataUnit(si, "PeoplePln", "E#UK", "Local", scenarioTypeId.Budget, "S#BudgetDefault", "T#2021M5", "YTD", True, "UD1 = 'IT' And Account = 'Bonus1'", 1, False)
brapi.ErrorLog.LogMessage(si,$"original DT - {PrintDataTable(si,originalDT)}")
Dim xfDT As xfDataTable = Nothing
xfDT = New xfDataTable(si,originalDT,Nothing,1000)
Dim resultDT As DataTable = xfdt.ConvertToDataTable(si)
brapi.ErrorLog.LogMessage(si,$"result DT - {PrintDataTable(si,resultDT)}")
The ConvertToDataTable worked ok in my case so this could either be:
- a version related issue (I'm on v8.2.0)
- an issue with your objJobStatus.RemoteJobResult.ResultSet object
- some type of special name / character that is causing an incompatibility with the ConvertToDataTable - I'd try testing it with a simplified version of this table first