Help needed to define rowfilter string

  • Thread starter Thread starter precious
  • Start date Start date
P

precious

I want to define a rowfilter like this:

dataview.rowfilter="WeekOfYear(datecolumn)=WeekOfYear(Now)"

Can anybody help me?

TIA


J Justin


N.B I tried like this... but didn't workout...! (The error was "expression
contains undefined function call DatePart()")

dataview.rowfilter= "CONVERT(DatePart(DateInterval.WeekOfYear,
Punch_Dt),'System.String')='" &
DatePart(DateInterval.WeekOfYear, sysToday) & "'"
 
Something like

dataview.rowfilter="WeekOfYear(datecolumn)=" & CStr(WeekOfYear(Now))

or

dataview.rowfilter="WeekOfYear(datecolumn)=" & WeekOfYear(Now).ToString
 
My rowfilter is
dataview.rowfilter=
"CONVERT(DatePart(DateInterval.WeekOfYear,Punch_Dt),'System.String')='" &
DatePart(DateInterval.WeekOfYear, sysToday) & "'"

The error was "expression contains undefined function call DatePart()"

J Justin
 
OK, I don't know how to do that, other than an ugly brute force method.

That method would be to add a column (not a calculated column), fill it with
the values via normal .NET code something like

For i As Int32 = 0 to rows.Count-1
row(i)("NewColumn") =
Ctype(DatePart(DateInterval.WeekOfYear,row(i)("Punch_Dt"))), System.String)
Next

dataview.rowfilter="NewColumn = '" & DatePart(DateInterval.WeekOfYear,
sysToday) & "'"
 
Back
Top