web
You’re offline. This is a read only version of the page.
close
Skip to main content
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)
  • Vilmos Kintera Profile Picture
    46,149 on at
    RE: Date type for dual entry (From and To Date)

    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

  • Community Member Profile Picture
    on at
    RE: Date type for dual entry (From and To Date)

    Thanks for your great suggestion.

  • Community Member Profile Picture
    on at
    RE: Date type for dual entry (From and To Date)

    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.

  • Vilmos Kintera Profile Picture
    46,149 on at
    RE: Date type for dual entry (From and To Date)

    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
    RE: Date type for dual entry (From and To Date)

    Thank you suresh this is my solution.

  • Community Member Profile Picture
    on at
    RE: Date

    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.

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

    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
    RE: Date

    Hi,

      Hope you got the solution, please mark helpful answer.

  • Verified answer
    Community Member Profile Picture
    on at
    RE: Date

    Hi,

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

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

        Data.JPG

  • Suggested answer
    Erik HB Profile Picture
    205 on at
    RE: Date

    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.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans