in my data table I want to sort this “Transaction_Date” column with two dynamic variables which are,
Start_Date=now.Date.AddDays(-7).ToString(“dd/MM/yyyy”)
End_Date=now.Date.ToString(“dd/MM/yyyy”)
output should be something like this “Start_Date<=“Transaction_Date”<=End_Date”
i want to get “transaction_dates” which only on that specific date period
Hi @Ishan_Ranasinghe ,
You would need to perform correction with the variable types and keep the type as DateTime
instead of String.
Start_Date=now.Date.AddDays(-7)
End_Date=now.Date
Here, Start_Date
and End_Date
are DateTime
type variables.
Then For Filtering, Could you check the below Expression :
DT = DT.AsEnumerable.Where(Function(x)Start_Date<=CDate(x("Transaction_Date").ToString) andAlso CDate(x("Transaction_Date").ToString)<=End_Date).CopyToDatatable
Here, DT
is the Datatable variable.
For Errors on Direct CopyToDatatable, Check the below post :
This FirstAid Tutorial will describe how a the source contains no DataRows EXCEPTION can be handled.
Introduction
Let’s have a look at the following filter data table scenario:
Name
CCode
Tom
US
Charlotte
FR
Seema
IN
Jean
FR
Assignment:
Filter all rows on a particular Country Code like FR, UK, ES, UK…
Ensure that all CCode data column values are trimmed
Ensure that the Filter check is case insensitive
we can implement it e.g. with the help of a LINQ statement:
dtData.As…
1 Like
Hello @Ishan_Ranasinghe ,
Refer to this xaml file, you may get some idea.
DateFilter.zip (82.8 KB)
1 Like