Getting the data in excel if match with current date

Hi all,

I want to get the data in excel if when i’m checking the date in column C is matched with current date
For example
image
if column C is matched with current date then we get the data in column D in same row.

I already get the data using for each row but i think the result is different with what im expecting.
Please give me your advice about this.

Thanks

Best Regards

Delf

GM Delf,

write a If condition in for each row like below,
for(row : dt) {
if(row(2) = Now.ToString(“dd-MMM-yy”)){

}
}

please a give a try, i did not execute this statement :slight_smile:

Cheers,
Pankaj

Hi @Pankaj.Patil

Thanks for reply

image

I’m try your code but it seems i didn’t quite get what you mean. Can you elaborate further?

Thank you

Best Regards

Delf

Hi…
First you need to get your date in the same format which is present in excel.
So in condition give !!!row.item(“col name”).tostring=datetime.Now.ToString(“d-MMM-yy”)!!!
try this hope it works.
And give tolower or topper in case of case sensitive.

Thanks

@delf
In the if condition,
row(3) = now.ToString(“dd-MM-yyyy”)

data type for row(3) will be an object and not string. hence you are seeing the error.
assuming the date value retrieved from row(3) will be in “dd-MM-yyyy” format, use,
String.Compare(row(3).ToString, now.(“dd-MM-yyyy”)) = 0

In case if row(3) is in different format, convert the “now” value to matching format.

Hope this helps!

Hello Delf,

Please find below screenshot,

If%20condition

Cheers,
Pankaj

Hi @Pankaj.Patil

Great i can use that as well.

On this occasion i want to ask again how to use if for datatables
for example
im type this in if activity
dtwht.Select("[Reference]=‘Doom’") but its getting an error system data row cannot be converted to boolean.
Sorry for asking some silly question

Thanks

1 Like

Hi @delf

If you want to test if any rows match you Select query, you can add .Any at the end like this

 dtwht.Select("[Reference]='Doom'").Any

This will return a boolean for you :slight_smile: