This is a migrated thread and some comments may be shown as answers.

Filter DateTime using 'Now()' or Getdate()

13 Answers 289 Views
Filter
This is a migrated thread and some comments may be shown as answers.
cm
Top achievements
Rank 1
cm asked on 29 Mar 2010, 11:15 PM
Hi All,
I'm wondering if there is a best practice to filter DateTime Values - but using a runtime 'current time' value.
(Example: Filter All 'events' WHERE StartTime < getDate())
Thx

13 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 01 Apr 2010, 02:46 PM
Hello Chris,

I am afraid that I do not completely understand your question. RadFilter offers UI for user to build complex filter criteria. Thus when filter on field which type is DateTime, the user should choose the date from UI.

Greetings,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
chris mcmurray
Top achievements
Rank 1
answered on 13 Apr 2010, 01:33 AM
Hi,
To Clarify; The issue is about trying to use a "RunTime" Date when filtering by date.
We are using RadFilter to allow Users to Build & Save Filters. They will run at a later date.
I would like to use the Date that they Run...NOT the date they are Saved.

Example:
Data: Concerts Dates - From Jan 2009- Jan 2015
Objective: Show Next Available ConcertDates  (based on Runtime Date)
Filter Saved on April 2010

RunTime : May 2014

Filter Should kind of Look Like: 'SELECT * FROM Concerts WHERE DateStart <= eval'getDate()'

Anyway to do this kind of thing?

Thanks
CM
0
Nikolay Rusev
Telerik team
answered on 16 Apr 2010, 07:30 AM
Hello Chris,

I am afraid that this is not supported by RadFilter. In general you can get the collection of build expression by RadFilter in RootGroup. Using the collection you can build your custom expression that will be saved.

Kind regards,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
apb
Top achievements
Rank 1
answered on 11 Jun 2010, 08:14 PM
I have the same need for relative date filters. We also persist the filters and date filters such as "1 Day", "1 Week", etc, would  be far more useful.
0
Nikolay Rusev
Telerik team
answered on 17 Jun 2010, 07:29 AM
Hello Al,

I can offer you implementing custom editor for RadFilter that have an option for choosing options. I have attached sample implementation to this post. Give it a try.

All the best,
Regards
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
cm
Top achievements
Rank 1
answered on 21 Jun 2010, 06:41 PM
Hi guys,
first of all - thanks for the Code & the effort.
My Question is this:

"OnFieldEditorCreating" and class RadFilterFieldEditorCreatingEventArg...

I don't seem to have these in my version of RadFilter...
Is this code for the upcoming Q2 release?

Thanks,

0
Sebastian
Telerik team
answered on 22 Jun 2010, 08:20 AM
Hello chris,

If you use the latest SP release of the suite (2010.1.519), you should have OnFieldEditorCreating server event exposed for RadFilter. Upgrade instructions are available here.

Best regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anne
Top achievements
Rank 1
answered on 27 Jul 2010, 01:23 PM
I try to add this code in my asp.net application in vb with visual studio 2008.

I add

<%

@ Register TagPrefix="custom" Namespace="FilterEditors" %>

 

 

 

 

 

 in my page
and FilterEditors.vb in my solution

but Imports FilterEditors is not recognize.
I have the same probleme with namespace CustomEditors to do RadFilterDropDownEditor

Will you add an expression like date() and date()+1, and 'RadFilterDropDownEditor' in a next release ?

Anne


0
Nikolay Rusev
Telerik team
answered on 30 Jul 2010, 08:18 AM
Hello Anne,

Bellow you can find VB version of the page from my previous posts.

Regards,
Nikolay
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Anne
Top achievements
Rank 1
answered on 30 Jul 2010, 02:44 PM
Thanks Nikolay
I will test it soon.
0
Anne
Top achievements
Rank 1
answered on 03 Aug 2010, 08:55 AM

Hello Nikolay,

<

 

custom:MyEditor> is not recognize in my web application.

I add namespace="FilterEditors" in the web.config : no success !

Anne

 

 

0
Anne
Top achievements
Rank 1
answered on 04 Aug 2010, 01:23 PM
Hello Nikolay,

I find my problem. My solution :

<%

@ Register TagPrefix="custom" Namespace="MyProject" Assembly="MyProject" %>
and I don't use namespace in the assembly 'MyEditor'

Anne

 

0
Anne
Top achievements
Rank 1
answered on 03 Sep 2010, 03:02 PM
Hello Nikolay,

I undestand why my code doesn't work. I try to add FieldEditors to my RadFilter. But my RadFilter has a FilterContainerID.

Sometime, I have more than 50 columns in my container so I don't want make 50 FieldEditors.

So I make my owner filter to use getdate() or getdate()-1 or getdate()+4.

Anne
Tags
Filter
Asked by
cm
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
chris mcmurray
Top achievements
Rank 1
apb
Top achievements
Rank 1
cm
Top achievements
Rank 1
Sebastian
Telerik team
Anne
Top achievements
Rank 1
Share this question
or