web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Retrieving records that related to current session date in a view

(0) ShareShare
ReportReport
Posted on by

Hi all,

I have a view (HistoryView) in my AOT based on the query object (HistoryQuery) and I'd like to select records that have dateFrom <= SystemDateGet()
How can I do this?
I can't add just a simple range to a query using a SystemDateGet() function as a Value. Maybe current session date is stored in a table somewhere so I can just join it?

Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    Technically a view is a piece of SQL code stored in database and you can't use X++ functions such as systemDateGet() in SQL. Create a view without your filter and apply the filter when selecting data from the view.

  • Community Member Profile Picture
    on at

    I agree, so as far as I understood there are no places in the system that store current session date in a field of a table?

  • Martin Dráb Profile Picture
    237,948 Most Valuable Professional on at

    Storing current date makes no sense - it's changing every day :-) and users in different time zones may have different days at the same time. Current time is already maintains by OS and it's easy to ask for it (X++ functions, GetDate() in T-SQL), so there is now reason to store it in a table.

    You can also change the session date and time not to match the current date and time, but I don't know how it's stored. I assume AX somehow stores the offset from the current date and time. Also don't forget that it's for an individual session. In either case, it's not something you want in your view definition, in my opinion.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans