Axapta 2012 - Ax Views and GETDATE()

Viewed 3077

I'm trying to make a date range in a view work relative to today. But I'm not find any function to set in the query range to make it dynamic.

Example: enter image description here

Creates:

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[MYCUSTINVOICETABLEVIEW] AS 
SELECT T1.INVOICEID AS INVOICEID,T1.DATAAREAID AS DATAAREAID,T1.PARTITION AS PARTITION,T1.RECID AS RECID 
FROM CUSTINVOICETABLE T1
WHERE (INVOICEDATE<={ts '2017-07-18 00:00:00.000'})
GO

But instead of looking relative to last synchronization date, I want to look compared to today.

SELECT ... FROM CUSTINVOICETABLE T1
WHERE (INVOICEDATE<=GETDATE())

Any ideas how I can setup the query ranges for this?


Tried so far:

  • ..GetDate()
  • ..today()
  • ..currentDate()
  • lessThanDate(0)
  • "< GETDATE()"
  • < currentSessionDateTime()

According to How to refresh/Synch View based on a Query with dynamic range?, it's not possible (for UserID()). I want to double check if that's the same case for dates. The view is being consumed by a other application on the same box (not an Ax form).

2 Answers
Related