Check if Column Values equal current date

Hi All,

So I created a separate variable known as PublishedDateColumn assigned with

> ExtractDataTable.AsEnumerable.Select(Function(r) r(0).ToString.Trim).ToArray

ExtractDataTable being the Data Table, I then used a ForEach item in PublishedDateColumn

Using the if statement PublishedDateColumn.Equals(Now.ToString("dd MMM yyyy"))

It would filter the data table removing all values which are not the current date.

The problem is that PublishedDateColumn when using message box is being outputted as System.String() so it will always go to the else statement.

Any help would be appreciated. :slight_smile:

Fine
may i know the date format in that column use a writeline activity where mention as datatable.Rows(0)(“date-columnname”).ToString
so based on that we can come up with the expression
@Stabbathehut

it uses “dd MMM yyyy”

it is the one in excel
are we getting the same here in studio with the writeline activity

@Stabbathehut

Its just in a datatable and yes that is correct

great
so use this expression to get the rows with current date

datatable = datatable.AsEnumberable().Where(Function(a) CDate(a.Field(of string)(“yourcolumnnname”).ToString).Equals(Datetime.Now)).CopyToDatatable()

Cheers @Stabbathehut

Getting this error

kindly add this assembly reference in main.xaml by opening that in notepad

Cheers @Stabbathehut

image
Added but no luck

Fine
close the studio and reopen the same xaml
you will be able to see the asenumberable function
and kindly type from your end so that you could see the functions and its arguments to be passed while typing

Cheeers @Stabbathehut

loop through your DataTable
and you use if condition like this
row(“yourcolumnname”).ToString = yourCurrentDateTime Variable

1 Like

Thanks for the easy solution :slight_smile:

1 Like

No Problem
@Stabbathehut cheers

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