Date compare with Linq

Hi, is there anyone who can help me compare two dates in an excel sheet.
I would like to use Linq.

The Excel sheet looks like this:
Date From: 2002-01-03, 2010-01-01
and
Date To: 2020-01-01, 2022-01-01

And then want to get if the date is valid or passed.

Regards Mikael

@mikael.x.svensson
find some starter help here:
FindNotMatchingDateFormatDates.xaml (6.8 KB)

DT_FilterDates_Yesterday.xaml (8.2 KB)

In case of you need more specific help, just provide us a sample data excel and elaborate more on

does mean. From date is before or same as To Date?

@ppr

Thanks for the xaml files will look through them in a while.

Wrote a little wrong in my question, apologize for that.

I want to read out to date and compare it with today’s date. And if it is an older date, it should be printed: the date has passed.

Dates.xlsx (9.8 KB)
Heres the file

Find starter help here:
CheckDate_NotPassedToday_ResultColMessage.xaml (7.1 KB)

I would suggest to combine it with some parts from above shared XAMLs and filter out all dates not parseable into a seperate report. So the Bot would work more solid and reliable

Thank you so much for your help. Everything worked exactly as I had imagined. But I feel like I want to learn Linq properly. So I checked out this page:
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/linq/introduction-to-linq

And i want to do the examples they have here.

I have this excel file as a database:
image

And i try this in an assign, in UiPath, it does not work:
image

What am I missing?

I get this error message: An expression is expected.

I hope you can guide me in the right direction.

With kind regards Micke

@mikael.x.svensson
kindly note: LINQ is NOT SQL and the syntax is different.

grafik

  • the last ) in first line is to remove

dtTestDataOutput looks like a variable of datatype datatable. In that case the columns are referenced by
cust(ColumnNameOrIndex)

just refer to the provided xamls and crosscheck on how it was implemented

I really appreciate you helping me.

So the syntax on the guide i pointed to is SQL? it says vb.net.

Ok, so i looked at the othe xaml file and changed the code to:
image
and got rid of the error codes, but the writeline in the for each is empty.
How is that?

And another question: If i write cust(Country).ToString it cant find any thing, why?

With kind regards Micke

@mikael.x.svensson
let us do one thing and not mixing up topics. The origin topic was about date comparing with linq. And once it is solved just close the topic by marking the helping post as solution. Others, researching a similar solution will find it faster and direct.

About learning LINQ, following resources are helpfully:

In case of open questions will occur while studying LINQ, so just open a new topic and we will help you.

Yes i will do that.
Thanx!

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