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)

Date type for dual entry (From and To Date)

(0) ShareShare
ReportReport
Posted on by

hi all,

How to give Todate and fromdate  dates in single field.

thanks&regards,

j.lalitha.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Erik HB Profile Picture
    205 on at

    Hi Lalitha.

    You can do this by defining an Date-based Extended Data Type and adding an Array Element to it.  Just right-click on the "Array Elements" node in your new EDT after it has been created, and click "New Array Element".

    You can then use this data type when adding fields to your table, or as any other variable and/or method parameter.

    To access the individual elements in your code, you will need to use array syntax:

    eb_5F00_test.png

    static void Job4(Args _args)
    {
    EB_Test test;

    test[ 1 ] = mkDate( 1, 5, 2017 );
    test[ 2 ] = mkDate( 5, 5, 2017 );

    info( strFmt( "%1 - %2", test[ 1 ], test[ 2 ] ) );
    }

    If you need the field on a form, you can add the individual elements of the data type to wherever you need them.

  • Verified answer
    Community Member Profile Picture
    on at

    Hi,

        You can simple mention 2 dates in one field as below,

       "5/1/2017..5/25/2017"

        Data.JPG

  • Community Member Profile Picture
    on at

    Hi,

      Hope you got the solution, please mark helpful answer.

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

    Erik's tip might work though that will not allow you to natively store the values in Date fields, it is rather just a string. The answer from Suresh is useless since that is just a query range in a string field.

    If you really want a single control where you can enter two dates, AX does not support that out of the box.

    But you are in luck, because you can develop such form control yourself! It is called a .Net Managed Host Control, and you could develop it yourself to whatever specification you'd want.

    www.dynamics101.com/using-managed-host-control-microsoft-dynamics-ax-2012

    blogs.msdn.microsoft.com/.../dynamics-ax2012-the-managed-control-host-faq

    msdn.microsoft.com/.../gg840386.aspx

    You would not be able to bind the control to a form datasource/field directly, but with the events when the two entry fields are populated, you could extract the values there and put it yourself to a From/To date in a datasource in X++.

    Please consider if the time invested into making this happen is worth the effort. You would end up with a solution that is not easily upgradeable to a future version. I would recommend to just go with whatever is available in standard AX, and use 2 separate fields for 2 dates. Push back unrealistic requirements from customers.

  • Community Member Profile Picture
    on at

    Hello Vilmos Kintera,

        What is your problem here, you don't have rights to say my suggestion is useless. How can say it is useless.

       Moderators are there for to check my suggestion is correct or not, please stop using my name.

    Note: Lalitha didn't mentioned her question clearly.  then how can you say your suggestion is correct to this question, then your links also useless here.

    If you want to give better solution for the question, better think about the solution but don't  concentrate on my suggestions.

  • Community Member Profile Picture
    on at

    Thank you suresh this is my solution.

  • Vilmos Kintera Profile Picture
    46,149 on at

    Date type for dual entry (From and To Date) - How to give Todate and fromdate  dates in single field.

    Lalitha wants to enter values that will ultimately land in a FromDate and ToDate field of type Date, using a single entry field only.

    Now the problem with the original request is that it is unknown how the results are going to be used, because it is too vaguely described.

    There are two possible ways on how the request could be interpreted and used further:

    • Value assignment to a table that has FromDate and ToDate fields
    • Filtering based on the values provided in a where clause of a select statement, or a custom query

    By the recommendation of using a string edit where you split the values by Erik, or by using a ManagedHost control Lalitha would be able to satisfy the requirements for both outcomes, thus those could be considered as correct answers here.

    Suresh, do not feel offended if someone tells you that providing half-baked answers is almost equal to not providing an answer at all - this is not the first time you do this on the forum. If you would have taken the time to carefully understand Erik's suggestion, he has already provided the correct answer using the same technique as you have suggested, but in a working way by getting expected result of having the string field's values to be split into the destination Date type fields, which you have not provided. Steering Lalitha in a direction of such a complex place of a custom query filtering criteria to dig into the underlying code to be able to do something similar is actually stealing his time, thus I decided to cut it short by suggesting to skip your recommendation. I sincerely hope the explanation provided puts it in proper context for you.

  • Community Member Profile Picture
    on at

    Hello,

      Previously the subject is Date, now someone changed the subject for this question.

     You better know, half-baked answers will be provided for  half-baked questions. If you have that much time, just ask lalitha to post the question clearly.

  • Community Member Profile Picture
    on at

    Thanks for your great suggestion.

  • Vilmos Kintera Profile Picture
    46,149 on at

    Lalitha, would you care to explain how does the marked solution answer your original question please? For the sake of other users who have the same issue. Thank you

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 March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans