Hi ,
Here is my dt
Compliance Date
User
Bot Modified Date
02/13/2020 19:28:35
abercrombieandfitch_user
06/12/2024
2/13/2020 19:28
abercrombieandfitch_user
06/03/2024
02/13/2020 19:28:35
abercrombieandfitch_user
06/03/2024
I need to filter and take all the rows where Bot Modified Date is previous month . please help
I need to filter out all the rows where Bot Modified Date is previous month . please help
Anil_G
(Anil Gorthi)
June 12, 2024, 1:13pm
2
@tharani.natarajan
please try this in assign
dt = dt.AsEnumerable.Where(function(x) Cdate(x("Bot Modified Date").ToString).Month.Equals(Now.Addmonths(-1).Month)).CopyToDataTable
cheers
ppr
(Peter Preuss)
June 12, 2024, 1:14pm
3
Give a try at:
dtFiltered =
(From d in dtData.AsEnumerable
Let ds = d("Bot Modified Date").toString.Trim
Let dp = CDate(ds)
Where dp.ToString("MM-yyyy").Equals(now.AddMonths(-1).ToString("MM-yyyy"))
Select r = d).CopyToDataTable
Handling empty result:
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.AsE…
When DateParsing has to be adapted:
This FirstAid Tutorial will describe how DateTime parsing issues can be analyzed and handled.
Click spoiler text when in a hurry:
Example
Assignment
Following Excel data will be processed and the corresponding Quarter is to calculate for the particular task date
Input data:
[input_raw]
Quarter Calculation
Quarter = CInt(Math.Ceiling(YourDateTimeVar.Month / 3 ))
Initial Implementation
[initial_flow_raw]
tmpTaskDate = DateTime.ParseExact(row("Date").toString.Trim, "dd.MM.yyyy", CultureInf…
Kindly note:
we used the toString(“MM-yyyy”) trick to simply the month check
still the of doing date compares on DateTime DataType base is valid and should be applied
1 Like
ppr
(Peter Preuss)
June 12, 2024, 1:19pm
4
to elaborate more on this:
today: 12 June 2024
check date 05 May 2023
today.AddMonths(-1) = 12 May 2024
A month (5) on month (5) will result to true
But: 05 May 2023 is not previous month (May 2024)
So we used the String trick to bring quickly also the year into the check
system
(system)
Closed
June 15, 2024, 1:19pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.