Alpha Video Training
Results 1 to 6 of 6

Thread: Filter Grid With Date

  1. #1
    Member tommyrotten's Avatar
    Real Name
    Tommmy Braaten
    Join Date
    Nov 2009
    Location
    In Sunny....NW Washington.
    Posts
    154

    Question Filter Grid With Date

    Ok, once again I am stumped when it comes to using dates in an expression. I am trying to filter a grid that is a "view" by going to its query clicking in the filter field and selecting a date field in the primary table and writing
    Code:
    DateExpires >= Date() + 31.
    My goal is to filter a grid to only show the records that have a date that is greater than today's date plus 31 days.

  2. #2
    "Certified" Alphaholic chadbrown's Avatar
    Real Name
    Chad Brown
    Join Date
    Aug 2007
    Location
    Aurora, Ontario, Canada
    Posts
    1,412

    Default Re: Filter Grid With Date

    SELECT
    tablename.CREATED,
    (tablename_sql.CREATED + interval +(31) day) as ExpiryDate
    FROM
    tablename

    The above works for adding 31 days to a field called Created but you should be able to modify it and use curdate() instead of the field name like this

    ExpiryDate=(curdate() + interval +(31) day)

    This code all should work for SQL.
    Chad Brown

  3. #3
    Member
    Real Name
    Greg Taylor
    Join Date
    Feb 2009
    Location
    Columbus, Ohio
    Posts
    450

    Default Re: Filter Grid With Date

    I am still trying to figure out a redirect based upon a date. I have a MYSQL table with a date. If today is GREATER than the date in the table...redirect

    I want to use this for a deadline control. Once the deadline is past, don't give access to the grid to create more records.

    I am having trouble wrapping my head around dates for some reason...any help would be GREATLY appreciated!!

    Thanks
    Greg

  4. #4
    Member tommyrotten's Avatar
    Real Name
    Tommmy Braaten
    Join Date
    Nov 2009
    Location
    In Sunny....NW Washington.
    Posts
    154

    Default Re: Filter Grid With Date

    Im mobile right now...... but I think you would do this in the events area. Look up in the wiki about date functions. You can then put a date function in events area under an event that fires before the grid fires.

  5. #5
    Member tommyrotten's Avatar
    Real Name
    Tommmy Braaten
    Join Date
    Nov 2009
    Location
    In Sunny....NW Washington.
    Posts
    154

    Question Re: Filter Grid With Date

    Quote Originally Posted by chadbrown View Post
    SELECT
    tablename.CREATED,
    (tablename_sql.CREATED + interval +(31) day) as ExpiryDate
    FROM
    tablename

    The above works for adding 31 days to a field called Created but you should be able to modify it and use curdate() instead of the field name like this

    ExpiryDate=(curdate() + interval +(31) day)

    This code all should work for SQL.
    Ok, I am using dbf tables have decided to use a logical field to get what I want and in the field rules I am using this
    Code:
    IF(DATEXP > CTOD("now() + 31"),.T.,.F.)
    DATEXP is a date field that is already populated. What is not happening is that the Now()+31 is not calculating to today's date plus 31 days to turn the field .t. or .f..

    Any words of wisdom???

  6. #6
    Member tommyrotten's Avatar
    Real Name
    Tommmy Braaten
    Join Date
    Nov 2009
    Location
    In Sunny....NW Washington.
    Posts
    154

    Talking Re: Filter Grid With Date

    Quote Originally Posted by tommyrotten View Post
    Ok, I am using dbf tables have decided to use a logical field to get what I want and in the field rules I am using this
    Code:
    IF(DATEXP > CTOD("now() + 31"),.T.,.F.)
    DATEXP is a date field that is already populated. What is not happening is that the Now()+31 is not calculating to today's date plus 31 days to turn the field .t. or .f..

    Any words of wisdom???
    Ok I figured out....

    It was a rookie mistake. I kept using the ctod() function which turns it into a Char format and I am working with a Date format. Once i took the ctod() out of it....shazam it is doing what I want.
    Code:
    between(Datexp,Date(),Date() + 31)

Similar Threads

  1. Use Grid search form to filter child grid
    By aburningflame in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 10-26-2010, 10:09 AM
  2. "Simple" filter problem using week() Function to filter grid
    By Scholin in forum Application Server Version 9 - Web/Browser Applications
    Replies: 2
    Last Post: 01-04-2009, 10:37 PM
  3. Filter Grid by user group upon Grid Load
    By andi in forum Application Server Version 8
    Replies: 0
    Last Post: 06-13-2007, 11:30 PM
  4. Date Filter
    By vinyltap in forum Application Server Version 8
    Replies: 7
    Last Post: 06-04-2007, 05:51 PM
  5. Date Based dropdown list filter does not filter
    By Steve Bovino in forum Web Application Server v6
    Replies: 17
    Last Post: 10-15-2005, 09:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •