In the modern design, I need to convert each data row into a String array from an excel sheet 1 row at a time. I require the conversion method to do that. got it working in classic not modern
usinf “row.ItemArray.OfType(Of Object).Select(Function(x) If(IsDbNull(x),String.empty,x.ToString)).ToArray”
If I use this method i get the error
“For Each Row in Data Table: Object reference not set to an instance of an object.”
please assist if you can.
Hi,
For now, can you check if DTElements variable is null? The above seems output of ReadRange is empty…
Regards,
As Yoichi-san mentioned your Data Table is probably not initialized.
You did not specify it in the Output of Read Range activity, so that may be the reason.
Ok thanks guy but as a beginner I not quite sure how to fix this even given you help, I sorry i am only looking for the way to convert each datarow into individuals arrays as i process the excel sheet I will attach another image in relationship to the DTElements variable
DTElements variable is null? The above seems output of ReadRange is empty. How ca i tell that.
lake of knowledge on my side
I have tried this DTElelemts.Rows(0).ItemArray.Select(Function (x) x.ToString().Trim).ToArray(), but I get this error message again not sure what I need to do.
Hi @bruce.switzer ,
We could see from this Image that you have not assigned an Output variable to the Read Range Activity. You would need to use the DTElements
datatable variable as the Output variable of Read Range Activity. In the Save To Property of Read Range
Activity, provide the DTElements
variable.
Hey @bruce.switzer
So you want to extract array from datarow and then process each one in the loop? Why don’t you simply use data table?
Anyway, if you want to process each DT row as an array in the loop, you can use the code you posted in 1st post.
Please take a look at this example.
arrayInLoop.xaml (9.1 KB)
thanks for the help guys the only different I am trying to do is load from a excel file
I assume the I need to do a Use excel file then read range or something like that as I like to use excel file and not build data tables if possible.
For Each Row in Data Table: Object reference not set to an instance of an object.
as always thanks
Did you get a chance to check the above post, The Error that you’re receiving is due to the Empty Datatable value. You are not storing the Read Range
Activity’s Output to the Datatable.