Convert Column in Data Table to Array

Hello,

(From row in portfolio_population_csv.AsEnumerable() Select Convert.ToString(row(“Loan ID”))).ToArray()

I am using the above to convert a column in a datatable to an array of values. However, it returns System.Array{} rather than the array of values stored in the column. Please help, thank you.

4 Likes

Fine
kindly try with this expression
yourdatatablename.AsEnumerable().Select(Function (a) a.Field(of string)(“yourcolumnname”).ToString).ToArray()

Hope this would help you
Cheers @automationfinance

21 Likes

Hi,
I am using the below query to convert one column of my datatable to string array :

String array = (dt2.AsEnumerable().Select(Function(a) a(5).ToString)).ToArray

But I need to convert mulitple columns (3 columns from the datatable into string array) using the above query, Please help

1 Like

hi palani ,
i have a read an excel file from A2:A5 image
and convert to datatable name “value” -
i have to convert this values to list of array . iam getting this error


please help me

@senthil.it89

Hi Senthil,

I think your number variable is in array of integer. Can you please check and change.

Thanks,
Aman

Kindly remove the double quotes around the value in assign activity
Cheers @senthil.it89

image - see again it throws error

May I know what we are trying to get out of this expression
Because we need some slight changes in the syntax. That’s why buddy
Cheers @senthil.it89

please find this , and help me out. i have a take an input from excel sheet and pass to onepopup window in website and if matches i have to do check box selection.

palani if possible share me num we will discuss on live projects a lot.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.