Skip to main content

Adding Custom Database Functions or Fields

Comments

4 comments

  • Jeremy Mapes

    There are no examples of of the content that might be used in the filter. I have tried to copy simple SQL statements and this fails every time. For example, maybe I want the year from @LASTMONTH. I would assume it to be SELECT DATEPART(year, @LASTMONTH)
    but that doesn't seem to work. Examples would help.

    0
  • Tony Coffman

    Hello Jeremy,

    Database Functions code is sent directly to the database to evaluate. @LastMonth is not a valid expression to send to a SQL or Cache database, @LastMonth is a reserved word for VDM used specifically for filtering. To get the results from last month your database function would return a date value. You'd then apply a filter for the database function where it is equal to @LastMonth.

    0
  • Robert Richardson

    I agree - having documentation to reference re: commonly used syntax would be very handy. (Cache).

    0
  • Tony Coffman

    Hello Robert,

    Jeremy's question was related to Reserved Words and Special Data Filtering Options. These are processed locally and then sent to the database as actual dates. Additional documentation and examples of Special Date Filter Options is available here. https://support.bridgeworksllc.com/hc/en-us/articles/200375239-Special-Date-Filtering-Options.

    As for supported Cache specific ODBC functions. Please check out the link below on InterSystems website. Custom Database Functions and Field's syntax are passed directly to the database for evaluation and processing. So any supported function for a database platform is available, and varies by the provider (MS SQL, Oracle etc).
    https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_FUNCTIONS

    0

Please sign in to leave a comment.