Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Date Searching

edited January 2002 in General
This seems like a newb question but holy cow I can't figure it out. On a
table with a date/time field, or just a date only field, I'd like to pull
only records from the database that are in the future.

IE. TableName.EventDate > TODAY

TIA.

Comments

  • edited January 2002
    Are you using TQueries or TTables? What DB engine are you connected to?


  • edited January 2002
    I'm not a programmer so TQueries and TTables is greek to me. M$ SQL Server
    is our database backend. The SQL Server GETDATE() function pulls the current
    system time in, but I can't figure out a way to utilize it. You can't use it
    under the Search tab on a data Query. And date comparisons don't seem to
    work in RAP under the Calc tab.

    I don't know what else to tell you.

    I suppose I could set up this report to ask the user for the current date
    each time it's run. But that seems cheesy. And quite unprofessional. I'm
    sure there's a way to do this the right way.

  • edited January 2002
    Expression searching in DADE isn't currently supported. You'll have to
    provide a date in the search criteria. Expression searching is on or ToDo
    list.

    To compare dates in RAP, use the detail band's BeforePrint event. Then check
    the pipeline field value against the function CurrentDate.

    if (plOrders['SaleDate'] > CurrentDate) then
    DetailBand.Visible := True
    else
    DetailBand.Visble := False;


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    I'd had this "skip record" in mind as a possible solution. Is there a way to
    do it that actually skips the record instead of just making the band
    invisible? On a large data return (which will happen every time the report
    is run if it has to pull all records then filter in a RAP statement) this
    would create a performance problem, I would imagine. I suppose a static
    filter could be set up on the Data Query that filters/searches only for
    records in the current year or month (greater than 01/01/02 or something),
    updated every so often, then this RAP statement refines the report to only
    future events.

    Thanks for letting me know this is on your To Do list. We'll look forward to
    it in a future release.

  • edited January 2002
    To limit the dataset, you need to use the Autosearch feature. When you are
    in DADE, you can set the search criteria to be an autosearch criteria.
    Since we don't support search expressions in searching, you'll have to have
    the user set today's date in the autosearch criteria.

    Unfortunately, you previously mentioned that you weren't a programmer, so
    this eliminates the option where you can write Delphi code to set the
    autosearch values behind the scenes at runtime, without showing the
    autosearch dialog:( There is an example of this in your installed
    C:\ProgramFiles\Borland\Delphi\RBuilder\Demos\AutoSearch\6.Set EndUser
    Search Criteria In Code\


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.