Check if date exists in data table and return row index if true

Hi Experts

I have a data table with a DateTime column and I need to check if a specific date already exists in column and the return the row index.

Can this be done? I have tried using the Lookup Data Table activity but that only seems to support string values as lookup.

Any ideas?

@jacchr

Can you share me the screen of the Data table and also format of the DateTime

Refer below post for your reference

Thanks

2 Likes

Hey @jacchr :wave:

Kindly follow the steps to achieve this:

  1. Read your DT from Excel.
  2. Iterate through the DT.
  3. Use an if condition to check if the Convert.ToDateTime(row("Date")) matches the required date and time.
  4. If it does, you can get the index using YourDT.Rows.GetIndex(row).

Try it and let me know if you are facing any issues!

Cheers!

2 Likes