Data table doubt

Hi all, i have doubt how to use conditions on for each row!


i want to get the date from work item page as less than 01/01/2018
so how can i write the code inside IF
've tried like row(“Type”).Equals(“WI4”) and row(“Status”).Equals(“Open”) and row(“Date”)>=2018-01-02

but its wrong!!
please make me correct how should i get the date from the DT.

Thanks

Instead of IF condition, please use Data Table Filter to select the matching rows or use DataTable.Select method to filter the rows.

If you still want to use the conditional statement, then

convert both dates into date format

DateTime dt1 =  DateTime.ParseExact(row("Date").ToString,"YOURDATEFORMAT", System.Globalization.CultureInfo.InvariantCulture)
DateTime dt2 = new DateTime(2018,04,30);

Condition:

row("Type").ToString == "WI4" AND row("Status").ToString == "Open" AND dt1.Date >= dt2.Date

Regards,
Karthik Byggari

Hi @naveen19,

Use .ToString()

Try below code

row("Type").Tostring()="WI4" and row("Status").Tostring()="Open" and row("Date").ToString()>="2018-01-02"

Regards,
Arivu :slight_smile:

2 Likes

thanks its working

1 Like

thanks its working:)

Excercise.zip (2.3 MB)

hi bro only 1st page getting read and getting appending on Excel.
but need to filter from all the pages of DT right please help me to solve this

hi bro only 1st page getting read and getting appending on Excel.
but need to filter from all the pages of DT right please help me to solve this.
Excercise.zip (2.3 MB)

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