Compare DD

Hi all ,

I am having a Datatable , which has many columns

now how to compare both the columns values?
Column D and column F have the Dates (dd/mm/yyyy) format

column D column F
1/1/2018 1/1/2018 (if same value then ignore)
_20/1/2018 30/1/2018

20/1/2018 _30/1/2018(_consider this value , as i want different date values for both the columns , consider the rows with different column values )
i am having like this many rows for these columns..

when u get different value for Column D and column F then u should click on to the cell present in same row in column A

Can any one please guide me?

Sonika

Can any one please help me with this issue…
Please

you can try this,

  1. compare two columns of a datatable using

For Each dr as DataRow in dt.Rows

If dr(“col1”)<>dr(“col2”)

Then --your condition

End If

Next

  1. when u get different value for Column D and column F then u should click on to the cell present in same row in column A i dint understand this, what do u mean by click

thanks
Yogananda

Hi Ananda,

The point number 2, that is :
if dr(“Column D”)<> dr(column F ) then
click on the column A’s Cell
End if

So how to click the particular cell corresponding to the above condtion?
do i need to change the selector of click activity, n if yes how to change it? n it should happen dynamically(as its a big table)

n one more condition i have to take care that is --> dr(“Column D”)<> dr(column F ) and also if Column M =" "(if column M has any new value in it then program should ignore that particular row…
How to do this??

Its a SAP application.

Hope i have explained good. i tried my best

Thank you
Sonika

you want to click on a particular cell, does cell contain any objects or what you are trying to perform with it,

give us a screenshot or something to understand better.

thanks
Yogananda

Hi Ananda,

Yes sure I have attached the screen shot.

step1: there is a report created in the SAP.(this report usually have too many rows some time 100 some time 20 some time 50 rows etc… dynamic)

Step2: find the difference between 2 columns(these 2 columns have the dates) and in 3rd column if “x” is present then we should not click on column A cell of the table. we have to do this row by row. i mean loop through the table.
Step3: when i click on this cell A( the Uipath should click it on its own ) in the same row where above step 2 condition is satisfied it opens the next screen

Regards,
Sonika

you can try this,

  1. compare two columns of a datatable using

For Each dr as DataRow in dt.Rows

If ((dr(“col1”)<>dr(“col2”)) or col(outbound) ==“X”))

Then --your condition

Here you need right click activity to click on the cell

try to use recording to click cell and check selector to use

End If

Next

Thanks
Yogananda

Hi Yogananda,

I previously addressed u wrongly , i am sorry.

well - Here you need right click activity to click on the cell
Sure i will do right click. But as i said its in a loop - so i will put for each loop(i can use the for each loop). and i want this right click to be dynamic(means click on A22,A99, A100 once the condition is full filled)… that is - as i loop through then where ever the condition is full filled there it should automatically go n double click the hyper link present in the the A cell.

Some times cell A5, some times Cell A99 , A22, A60 etc…

well one more question, i am able to take this entire table to excel sheet as shown in screen shot. but not able to take it to Datatable.

Well thanks for all ur quick response. i will try the solutions provided by you.

Regards,
Seema

Hi ,

The piece of code which you mentioned above in RPA is not working,
n i added the If activity, tried to write the code - if datarow(column1)<>datarow(column2) and datarow(column10) ="X"

well its showing compiler error…
Please find the screen shot.
Also do i need to write any select queries? for which ever row the condition is full filled should be copied to another datable and excel.

Please help me out

Thank you,

Hi Yogananda,

Can you please help me out with this issue. Thanks in Advance

Sonika

i just found in uipath site one select query, but i am not getting how to modify it for the columns and write the colndition for IF block

(From p in datatable.Select()
where Not p(“Name”).ToString.Split({" "},StringSplitOptions.RemoveEmptyEntries).Any(Function(d) p(“Company”).ToString.Contains(d))
Select p).ToArray.CopyToDataTable()

i feel its a linq query.
So similarly can we change the above code for the columns

i need immediate help.

Can anyone there please help me

p1.zip (9.4 KB)

This is the workflow which compares two colmns( I have used col1 and col2). if both matches it will store the result rows into new datatable.

thanks
Yogananda

Hi Yogananda,

I did it in the following way
DT1.Select(“col1< >col2 And col3=’’”).CopyToDataTable()

Regards
Sonika

This particular code is able to satisfy only one condition that is - DT1.Select(“col1< >col2 And col3=’’”).CopyToDataTable() — i have made it bold
But its not wotking for col3-"" -> if column 3 contains any value then it should be ignored. if its blank then only we should consider…
Please help me out with this

i have doubt,

  1. you need to satisfy any one conditiobn in this col1< >col2 or col3=’’”

  2. you want to verify both to true, then only it should work

as for your prob, even when i tried its not accepting both the conditions.

–> For this you can try like this use two if conditions,

if DT1.Select(“ col1< >col2).CopyToDataTable()

if DT1.Select(“ **col3="" **).CopyToDataTable()

from here you can merge the datatable or use two seperate datatable for your operations

thanks

Hi Yogananda,

Ok you are right, but how should i put it in “If Activity” , i had used it with the assign activity. can u put a screen shot or a .xaml file, also one more thing is that once both the conditions are full filled i have to use the for each loop to scrape other activities.
i just want to know which activities to be used . can you share a .xaml for this please…

Thank you
Sonika

you dint answer my ques,

  1. you need to satisfy any one conditiobn in this col1< >col2 or col3=’’”
  2. you want to verify both to true, then only it should work
1 Like

Ho i am really sorry,
Actually both the conditions should be satisfied at one shot.
Yes both should and must be true then only i should be able to put it in to the DT.

after that there is big for each loop i have to put…

excel.xaml (9.6 KB)
Book1.xlsx (8.0 KB)

Try this i have used Linq query for col1< >col2
and filter datatable for col3=’’X”

change it according your need ( Filter datatable )

Thanks

n nj nn