How to Loop the data row?

Hi,

How to compare the Data rows of the particular column.
For example
There are 7 records in data row i need to compare 1st value to all and 2nd value to all similarly for all the records, if the records matches the row value should be write it into console.

Thanks in Advance & Best Regards

@badita

Hi @jothyprasanth.m,

Follow the below 2 steps

Step 1 - You need to get the Row count of DataTable & store it in a variable

Step 2 - Create a Loop and check like [DataTable_Name].Rows([Row_Index]).Item([Coulumn_Index] or [Coulumn_Name]).ToString() = [DataTable_Name].Rows([Row_Index] + 1).Item([Coulumn_Index] or [Coulumn_Name]).ToString()

Note : Ensure your loop should run until [Row_Count] - 1, because if it run until last row, there will be an error occcur.

Hope this helps to you :slight_smile:

1 Like

Do u have any Samples for this so that i can understand easily @cthamizh

If you have an data attach that Excel file and let me know which column you need to compare?

So that I can try to share the UiPath Working file.

sample.xlsx (7.8 KB)

In this file i need to print the client_active Column

Can anyone tell me the answer

Hi @jothyprasanth.m,

please find the attached flow

test4.xaml (11.5 KB)

Regards,
Vikas Reddy

@vikas_reddy_Vicky
Thank you so much for your response

@vikas_reddy_Vicky

My requirement is like i have to find the duplicate in a particular column and if its a duplicate then i need to concatenate the other column values(which are not duplicate)…

Say Example
This is the input file →

Output–>

Hello,

From what i remember your problem seem to be similar to this post :

There was a workflow attached doing the initial task.

Cheers

PFA
Grouping.xaml (25.7 KB)

In the Attachment
i have done with excel file but i didn’t get the solution yet

My requirement is to get the data from excel and update the values into another excel.
Can anyone tell me the answer that is helpful for me

hi guyz can anyone tell me how to determine row index while iterating through for each so that i take the similar value occuring for first time.
based on my condition there are 3 rows with similar calue i just need to grab the first value from other column.Please help

Hi there @1vivek12,
You can acquire the row index via:

dtMyDataTable.Rows.IndexOf(drMyDataRow)

Thanks,
Josh

Thankyou josh got it.but how should I stop the iterationand get a value from only first row and not iterate further.

My condition is
If
Site_ID = MSL05608
Then assign
Carrier = the first value ie 2c
But I am getting 4C
Please help
I just want to get value from column Carrier as 2C ie when rowindex is 0

[/uploads/default/original/2X/5/5580a1388353c5d9727f4008756bdd02362eb450.png]

Hi there @1vivek12,
I’m not 100% certain I understand your issue, you can assign the row index upon finding your required row and then use the ‘Break’ activity to stop the iteration.

Do you just want to remove any duplicate entries within your DataTable, based on the ‘Carrier’ column?

Thanks,
Josh

Yes, I want to remove the duplicates based on carrier can you help me with tha

Hi there @1vivek12,
Please see the following:

dtMyDataTable = dtMyDataTable.AsEnumerable().GroupBy(Function(i) i.Field(Of String)("Carrier")).Select(Function(g) g.First).CopyToDataTable

Thanks,
Josh