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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to: Get FromDate, ToDate in Query range AX 2012 R3

(0) ShareShare
ReportReport
Posted on by

Hi experts,

I want to get FromDate, ToDate like pic below:

10_2D00_04_2D00_2017-14_2D00_54_2D00_02.jpg

I try to use this code:

_QueryBuildDataSource = _QueryRun.query().dataSourceTable(tableNum(ProdTable));
_QueryBuildRange = _QueryBuildDataSource.findRange(fieldNum(ProdTable, FinishedDate));

if(_QueryBuildRange)
info(strFmt("%1", _QueryBuildRange.value()));

--> the result: 01/12/2016..10/04/2017

Anyone has simple solution to help me convert _QueryBuildRange.value() to FromDate, ToDate?

Tks all.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

     

           Simply you can add date ranges in query range as below shown.

          Date.JPG

    Thanks

    Suresh

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

      Please look into below links which is solved earlier.

      community.dynamics.com/.../199073

      Also look into the link, which is related to your solution.

      stackoverflow.com/.../advanced-query-range  

    Thanks

    Suresh

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Try this in the init() of your formDataSource on the ProdTable table if you want to apply the range:

    SysQuery::findOrCreateRange(this.queryBuildDataSource(),
    fieldNum(ProdTable, FinishedDate)).value(SysQuery::range(12\01\2016, 04\10\2017);

    If you want to convert it from a string back to dates, then you need to use subStr() and str2date() methods.

    https://msdn.microsoft.com/en-us/library/aa554244.aspx

  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    Hi Thiennd,

    It's a strange requirement, however, you can use subStr() or strSplit() to get first part of the string 01/12/2016 and second part of the string 10/04/2017, then you can convert string to date using str2Date() function.

  • Community Member Profile Picture
    on at

    Hi Suresh potlakayalaVilmos Kintera and ievgen Miroshnikov

    Thanks for your replies.

    But I found out some problems in this topic may be the same as my issue:

    https://community.dynamics.com/ax/f/33/t/40866

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 24

#2
Michel ROY Profile Picture

Michel ROY 14

#3
Jagadabi Profile Picture

Jagadabi 6

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans