How to iterate through each row and display it as string?

Hi,

I want to iterate through each row of an Excel file and compare that to another row of a diffrent file. For this I started with a for each row loop:
for each row in DT → assign: rowstring = row.toString
message box displays “system.data.datarow”

what’s wrong ?

thanks
B.D

@B.D Can you share your xaml or screenshot. To easily address the issue.

cheers :smiley:
Happy learning :smiley:

2 Likes

You can use “String.join(”,“,Row.itemArray)” in Assign activity to place whole DataRow to a String

5 Likes

You need to specify the column index or column name you want to get from the datatable.
i.e. rowstring = row(0).ToString or row(“YourColumnName”).ToString

2 Likes

because it is an array of data i.e. all columns data present in that row
So you can write it like
Row(“Column Name”).tostring
or
if u know the index of column
Row(0).tostring------for 1st column

1 Like

Use row.itemArray() and assign to any array variable with string format.

Or use get row item activity and pass the item(row) and column name print it…

Hope it helps.

1 Like

can’t it check the entire row ?

As your title say you want just to display the row and the best way in my opion is the solution posted by @srdjan.suc .

If you want to compare an entire row with another to check if it is the same I think you have to extract each value from every column and compare it.

To access the value use: row(column_index)

Hope to help you.
Regards

1 Like

Awesome exactly what I needed. to get this right… So “string.join” joins each item to a single string format of the string array, “,” marks the seperation of the elements and “row.itemarray” specifies the type of the array ? Or did I get it wrong ?

1 Like

Yes exactly that :slight_smile:

1 Like

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