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

Custom SQL query with between :parameters

edited November 2010 in General
Hi,

For a report I would like to use a custom sql query with :parameters.
I have a problem with a date selection 'where datefield between
:parameter[0] and :parameter[1]'
I don't know the syntax but I would like to use 1 parameter with the
searchoperator soBetween.

How can I do this?

Using D2007, RB11.08.

Kind Regards,
Jeroen R?ttink

Comments

  • edited November 2010

    Configure a Report.Parameters[ ] item as follows:

    Set DataType to dtDate. Set AutoSearchSettings.SearchOperator to soBetween.
    Set SearchExpression with the date range (ex. 1/1/1990, 1/1/2000)

    The above works in my testing with RB 12.02.


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2010
    Hi Nard,

    For people following this thread the query should look like:

    select *
    from table
    where field between :parameter and
    field2 = 'cake'


    Other question: How to set these values from RAP?
    I can use Report.Parameters['start'] := StartSelection when 1 value is
    involved.

    Regards,
    Jeroen.


  • edited November 2010

    Example:

    Report.Parameters.Items['ppParameter1'].AutoSearchSettings.SearchExpression
    := '1/1/1991, 1/1/2010';


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2010
    Thanks Nard. That works!


This discussion has been closed.