Find column value index number in datatable

find withdrawal amt column value index number in datatabe …

Value Dt Withdrawal Amt. Deposit Amt.
01/05/24 270000
01/05/24 2967
02/05/24 50000
02/05/24 104400
02/05/24 42000
02/05/24 32000

Hi @domsmgtmeet22

Try this

columnIndex = DataTable.Columns.Cast(Of DataColumn).ToList().FindIndex(Function(c) c.ColumnName = "Withdrawal Amt.")

Regards,

@domsmgtmeet22

columnIndex = DT.Columns.Cast(Of DataColumn).ToList().FindIndex(Function(c) c.ColumnName = "Withdrawal Amt.")

Input:

image

Output:

Regards,

i need withdraw column values index number example i have four values of withdraw column find that index number

@domsmgtmeet22

Can you please elaborate and what is expected output from above input

Hi @domsmgtmeet22

index = String.Join(vbcrlf,Enumerable.Range(0, dt.Rows.Count).Where(Function(i) Not String.IsNullOrEmpty(dt.Rows(i)(dt.Columns.Cast(Of DataColumn).ToList().FindIndex(Function(c) c.ColumnName = "Withdrawal Amt.")).ToString.Trim)).ToList())

Input:
image

Output:

Regards

my out put is 0,1,4,5

@domsmgtmeet22

Try this

String.Join(", ", DT.AsEnumerable().Select(Function(row, index) New With {.Row = row, .Index = index}).Where(Function(x) Not IsDBNull(x.Row("Withdrawal Amt.")) AndAlso Not String.IsNullOrEmpty(x.Row("Withdrawal Amt.").ToString())).Select(Function(x) x.Index).ToList())

Regards,

please attach sequence files…

@domsmgtmeet22

Sequence26.xaml (8.6 KB)

Regards,

how remove that rows in datatable

Hi @domsmgtmeet22

Do you want to remove that index number rows from the datatable. Please specify.

Regards

yes… how to remove that index number in datatable

Hi @domsmgtmeet22

Check the below workflow

The below workflow will store the index in a list variable and remove those rows from the data table.

Sample Process 7.zip (35.6 KB)

Regards

is not working provide another

What isn’t working in your case. Can you share it with screenshots @domsmgtmeet22. SHare you expected Output here.

Regards