Hello Everyone,
Recently I have started implementing SAP GUI Scripting via PowerShell with the help of forum post by @StefanSchnell, everything works great for the most parts and I have found improvements of about 70% from I previously achieved by automatization via UiPath Activities.
However, I have ran into a roadblock that I cannot solve for the life of me. When using the “Invoke PowerShell” activity and trying to retrieve data from a nested DataTable I run into a “Late Binding” error, here’s an example of the PowerShell code below:
#-Init Data Table---------------------------------------------------
$Response = New-Object System.Data.DataTable
[void]$Response.Columns.Add("Key", "System.String")
[void]$Response.Columns.Add("Value", "System.String")
[void]$Response.Columns.Add("Data", "System.Data.DataTable")
#-Init Partners Data Table------------------------------------------
$PartnersTable = New-Object System.Data.DataTable
[void]$PartnersTable.Columns.Add("Partner")
[void]$PartnersTable.Columns.Add("Name")
#-Create A Dummy Row------------------------------------------------
[void]$PartnersTable.Rows.Add("Test1", "Test2")
#-Add Partners Data Table To Response-------------------------------
[void]$Response.Rows.Add("PartnersTable", "", $PartnersTable)
#-Return Response---------------------------------------------------
Return $Response
After running the code in UiPath I am able to get the “Response” and even view it in the “Immediate” tab, but trying to work with the DataTable any further results in a “Late Binding” error.
I can view the “PartnersTable”
But trying to access any of it’s elements results in the error
Any help is appreciated, I would prefer not to change the method of getting a Response unless it nets the same result. The main reason for this is since for some scripts I need multiple nested DataTables as an Output.