hi all,
How to give Todate and fromdate dates in single field.
thanks®ards,
j.lalitha.
*This post is locked for comments
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
Thanks for your great suggestion.
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.
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:
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.
Thank you suresh this is my solution.
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.
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.
Hi,
Hope you got the solution, please mark helpful answer.
You can simple mention 2 dates in one field as below,
"5/1/2017..5/25/2017"
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:
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Syed Haris Shah 9
Mea_ 4
Martin Dráb 2 Most Valuable Professional