Copying a value from colum 1 when specific date value is found in column 2 for each row


I am building a robot that needs to scrape data from a webpage (it will be a table) and that table has two columns (called POnumber and POdate).

I want the robot to read each row, reading the POdate and if that POdate is yesterday, then copy the POnumber from that same row. For example:

(this is a copy from the notepad, where I printed my table just to see the two columns)

1760 ,03/28/18
4701 ,03/27/18
1630 ,03/27/18
1619 ,03/26/18
1575 ,03/25/18

So, for this table, I want to read the first row, and ok, that is not yesterday, so nothing. The second row has yesterday’s date, so I want to copy the number 4701 from that same row. How could I do this, I have no idea?

After copying the number 4701, I want to find that number on a webpage and click on it, so I guess I need to save that number to a variable also?

Here is what I have come up with so far, but it is missing a lot (I am also not sure if the date will be in the right format if I use the code I currently have there):

(And yeah, I already have the table ready, so this is just for the comparison, copying the value, finding it on a webpage and clicking on it parts)

Hi @JohannaKes,

use if condition"POdate='03/28/18'").length>0

True →
DateTime datevalue=Convert.ToDateTime("POdate='03/28/18'")(0)("Ponumber"))


First get the list of PONumbers whose date is Yesterday.

ListA=(From p In Dt.Select
where DateTime.Now.AddDays(-1).ToString(MM/dd/yy).Equals(Convert.ToString(p.Item("POdate")))
Select Convert.ToString(p.Item("POnumber"))).ToList

Now the List A will contain only the yesterday POnumbers.

Now run foreach for ListA and Click on the elements if it founds.


Thank you everyone for your answers! They were helpful and we managed to use them in the solution.