How to retrieve headers of a dataRow element

Hi guys,

I am using the activity called For Each Row in order to iterate a table. As far as I understood, the output of this activity is a DataRow element. My question is how can I know in a loop the name or header of each column that DataRow has?

Thank you in advance

Using for each activity you can achieve this one
Try below code… implement in uipath as same

foreach (DataColumn c in dr.Table.Columns)  //loop through the columns. 
{
    MessageBox.Show(c.ColumnName);
}

Regards,
Arivu :slight_smile:

1 Like

Hi, Tks for your answer. I did not find the property called ColumnName. I attached what I did, but for variable headers, it does not have this property.

Hello @sergio85,

Try to set the For Each TypeArgument to “System.Data.DataColumn” .

  • TypeArgument - A drop-down list that enables you to choose what variable type you want to use with the activity.

Regards,
Susana

2 Likes

Follow @Susana instructions, so that you can get the headers

Regards,
Arivu :slight_smile:

Thank you so much for your help. It worked very well. Thanks @arivu96 too. Greetings

Hi @arivu96 and @sergio85,

How can i get the same column names when “For each Row” activity?
I can’t use “For each” activity now.

Thank you in advance.