Suhas_M
(Suhas Mariyappa)
1
How do i filter dates older than 01-05-2022. my date column is “Period From”
I tried filter data table activity but it is not working Hence, tried the select query and it looks like below
out_dt_fb(DataTable) = dt_fb.Select (“Period From< ‘01-05-2022’”).CopyToDataTable()
with this select query i am facing “Syntax error: Missing operand after ‘From’ operator.” exception.
Plz help in correcting the above query.
Hi @Suhas_M ,
Firstly, Could you check with the modified expression below :
out_dt_fb(DataTable) = dt_fb.Select ("[Period From] < '01-05-2022'").CopyToDataTable()
Check if the above works and Gives out the proper output.
If the above does not work, then give a try on the below Expression :
inputDate = DateTime.ParseExact("01-05-2022","dd-MM-yyyy",System.Globalization.CultureInfo.InvariantCulture)
Here, inputDate
is a variable of type DateTime.
Next, we use this Date variable for comparison like below and fetch the rows corresponding to older dates :
DT.AsEnumerable.Where(Function(x)CDate(x("Period From").ToString).Date<inputDate.Date).CopyToDatatable
More on DateTime and analysis :
Let us know if you are able to perform the appropriate filtration using this method.
ppr
(Peter)
3
can you try
dt_fb.Select ("[Period From] < #01-05-2022#').CopyToDataTable()
we used
-
[ ]
to surround the col name as it has space
-
#
for a date compare
https://www.csharp-examples.net/dataview-rowfilter/
when an empty result can occur handle it as described here:
When it is not working then share with us the datatable content by using the immediate panel
1 Like
RajKumar_DC
(RajKumar Durai)
4
Hi @Suhas_M
What about this
If(dtTest.Select(“[Period From] < #01-05-2022#”).Count>0,dtTest.Select(“[Period From] < #01-05-2022#”).CopyToDataTable,Nothing)
#01-05-2022#" = MM-dd-yyyy
Thanks,
Rajkumar
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.