How To Find Respective Column Name of a specific Item in a data table

Hi,
So, I’ve made a data table of column size 40 and row size 4.

However, i need to find if only the first 20 columns have empty fields. If it is empty, i want to use write line to output the name of the column in which the item is absent for each row.

How do i get the column name in this situation for a particular column?

Interested to know your views.

Thanks and regards,
Amit.

1 Like

Hi @AMIT_SINGH,

Inside For Each Row activity you can get all value using either column name or column index.
If you already know all columns name, use them to get value for each and verify if any value is blank or not.
If you don’t know column name in advance, you must be using column index to check each value. In this case, you can use ‘DataTable.Columns(Index).ColumnName’ to fetch the name of the column at that index.

5 Likes

Hi @Vitan,
Thanks for the syntax. It’s exactly what i needed. :slight_smile:

What if you don’t know how many columns are in the table? Is there a way to get a count of columns or a max index number?

Hey @michaelh

To get Columns count in a datatable you can use like this :slight_smile:

Int Col_count = YourDataTables.Columns.Count

Regards…!!
Aksh

1 Like