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

Search Criteria where the value is a field or a calculation

edited September 2006 in DADE
Hi,
I am using Delphi 6 + ReportBuilder 9.03.

My question has been asked before
--------------------------------------------------------------
For instance where a records date is less than today's date -
recordDate < getdate()
or two fields recordDate < OtherRecordDate
--------------------------------------------------------------

Nard Moseley answered on Mon, 27 Sep 2004 09:45:15 -0600 as
--------------------------------------------------------------
1. To search against a field value, specify tablename.fieldname as the
search value. (i.e. the fieldname must be qualified with the table name).

2. To search agains the Current_Date value, try adding a calculated field
and then specifying the search condition as CalculateField >
TableName.FieldName.
--------------------------------------------------------------
The original post shows the methods work. But I tried the 2nd method and
it didn't work. Exception said TableName.FieldName is not a valid date
string.

So how can I add GETDATE to the search criteria?

Bin

Comments

  • edited September 2006

    - I tried a simple example using SQL Server Northwind sample data and RB 10
    and it worked. I used the Query Designer to create a query on Employees. I
    added a Calculated field that contains a call to the SQL Server function
    GetDate(). I used the Search tab of the Query Designer to select the
    calculated field and then for the value I typed 'employees.hiredate'

    - The other approach is to create a SearchCriteria value and use
    TdaSQLBuilder class to modify the SQL at run-time, specifying the current
    date as string for the search value. The Report.OnInitializeParameters or
    Report.BeforeOpenDataPipeline events can be used to modify SQL.

    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.