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

using parameters in SQL statements

edited November 2009 in End User
I am trying to use a date parameter (start_date) in a function within an SQL
statement in a calc on the dataview..
(select etc where F_DATEINMONTHS(taxpoint_date,:start_date)=1)

I get the error 'Data type unknown'
If I replace the :start_date with an actual date it works.

Comments

  • edited November 2009
    Hi Colin,

    Which database and connectivity are you using? Are you able to get correct
    parameter output when using a simple expression such as Where taxpoint_date
    = :start_date ?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2009
    Interbase 2009 ibx

    The sql expression in the previous post was inaccurate, sorry.
    If I use the two expressions below in the sql editor on the dataview they
    both work.
    If I use them in calculated columns in the dataview, the second one fails
    with error 'Dynamic SQL Error -804 Data type unknown' when I try to 'OK' the
    expression in the dataview
    1.
    select entry_id from entry where
    F_ageinmonths(entry_1.taxpoint_date,current_date)=1
    2.
    select entry_id from entry where
    F_ageinmonths(entry_1.taxpoint_date,cast(:startdate as Date)=1
    :startdate is a Date variable defined in the report tree.


  • edited November 2009
    Hi Colin,

    The : syntax is currently only supported for manually edited SQL
    (edit SQL as text). For a future release we could possibly enable this
    syntax for a calculated field in the Query Designer.

    I believe in order to get the SQL you are after you will currently need to
    edit the SQL code manually as you mention below.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.