How to Loop the data row?


#1

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


#2

@badita


#3

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:


#4

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


#5

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.


#6

sample.xlsx (7.8 KB)

In this file i need to print the client_active Column


#7

Can anyone tell me the answer


#9

Hi @jothyprasanth.m,

please find the attached flow

test4.xaml (11.5 KB)

Regards,
Vikas Reddy


#10

@vikas_reddy_Vicky
Thank you so much for your response


#11

@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–>


#12

Hello,

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

There was a workflow attached doing the initial task.

Cheers


#13

https://www.codeproject.com/Questions/698207/Merge-Duplicate-Rows-on-a-datatable


#14

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


Automatisation of specific email send back
#15

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


#16

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

dtMyDataTable.Rows.IndexOf(drMyDataRow)

Thanks,
Josh


#17

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/uipath/original/2X/5/5580a1388353c5d9727f4008756bdd02362eb450.png]


#18

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


#19

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


#20

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