How to compare row1 to row2 and row 3 to row2 Of same datatable

I have one datatable in that I have 3 columns and 10 rows. Eg,

ColA. ColB. ColC

DF346. Yhkjuop. Yu5695

CZ950. Fhjsksj. To9835

CZ950. Fglqru. To9835

CZ950. Hsjaja. PO1276

I need to write the result in next column i.e colD.

For the 1st row we need to set bydefault value i.e 1 in colD.
Next, I need to check row2 of ColA and row2 of colC is same as above row or not. i.e we need to compare row2 to row1 .In a similar fashion we need to check row3 of ColA and row of ColC is same or not with the row2.

If rows are similar to above rows of ColA and ColC then write 0 in ColD.
If rows are dissimilar to above rows of ColA and ColC then write 1 in ColD

If only row of ColA is matching with the above row and row of ColC is not matching with the above row then write 0

It means we need to take “And” operation in between ColA and ColC

Please experts help mee

Welcome to the forum,

many options to implement it.

With a helper column containingt the row index and a group by on Col A we could setup a flow.

But lets have a view on the Business Case and what it is about. Maybe you can elaborate more on it.

Hi @Tabbu ,

Hope you are doing well.

Please find the attached workflow. This will help you with the scenario mentioned. Please mark this as a solution if the (12.5 KB)
workflow helped you resolve your query.

1 Like

And how to count the unique values with respect to ColA

Hi @Tabbu

Please use below expression.

dt1.AsEnumerable.Select(Function(r) r(“columnname”).ToString.Trim ).Distinct.ToArray

This is not working. I wrote this expression in assign activity but getting error.
"valye of type 1-dimensional array of string connot be converred to string

The output of the above expression is an Array. So try changing the variable type to string of Arrays.

If you wish to get the list of unique values as a string. Please use below expression.

String.join(dt1.AsEnumerable.Select(Function(r) r(“columnname”).ToString.Trim ).Distinct.ToArray,“,”)

Fir this i m only getting string.system as a output

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