dtInsert is a variable type String. (While I don’t necessarily need anything in this datarow I am trying to insert, I am trying a test string just for testing purposes with the add datarow activity.)
I am getting the following error: “Option strict on disallows late binding”
Really appreciate everyone’s help. I’m so close to completing a large suite of automations, and plan to share a step by step guide once I am complete.
Output from Chat GPT(Try it out if the below doesnt work):
The error message “Expression Expected” is indicating that the syntax of the Assign activity is not correct. The For Each loop needs to be inside a separate Sequence activity. Also, you need to assign the modified mrcPricing datatable in each iteration of the loop.
Try the following:
Drag a Sequence activity onto the designer panel
Inside the Sequence activity, drag a For Each activity
Set the dtDataTestIndex as the input of the For Each activity
Inside the For Each activity, drag an Assign activity
In the Assign activity, set the value to mrcPricing.Rows.InsertAt(mrcPricing.NewRow, item)
Assign the value of mrcPricing to itself.
This should insert new rows into the mrcPricing datatable at the index specified by the dtDataTestIndex array.
The “Option strict on disallows late binding” error message occurs when you are trying to use late binding (when the data type of a variable is not explicitly declared) in a VB. NET program where Option Strict is set to On. This is a feature in VB. NET that requires all variables to have their data types explicitly declared, and can help prevent type-related errors. To fix this error, you can either set Option Strict to Off in your program (by adding the line “Option Strict Off” at the top of your code file), or you can explicitly declare the data type of the variable that is causing the error.
In the add data row as per picture and the error the input you are providing and the target column datatype are different…
Ideally you would give an array input {value1} like this…this is for 1 column…add as many as you have columns with comma separation inside the curly braces…
Here dt.rows(item)(0) would give the valu of first column and the row number would be as per item value
Would have preferred to do it in the datatable inside UiPath, but this will work for now. The datatable would have ultimately been written to an excel sheet, so I guess this method is fine.
If anyone knows how to do this, but with the datatable inside of UiPath, please do share!