Notifications
Announcements
No record found.
Hi,
In AX 2012, if we use macro in the code, just declare #define in the beginning of the methods. How do we use Macro in AX 7 now?
Thanks,
*This post is locked for comments
In AX7 X++ now supports the const keyword.
It replaces most use cases of macros.
Have a look here for more details
blogs.msdn.microsoft.com/.../x-in-ax7-const-keyword
Hi Yuji,
In short, macros are now used as constants in D365O have a look on this post to see how you can use both.
devserra.wordpress.com/.../macro-or-const-on-ax-7-what-use
You can use macros the same way we did it in AX 2012. However try to use "const", in some cases it's not possible. For instance
#localMacro.DateFilter
((priceDiscTable.FromDate <= toDate || !toDate)
&& (priceDiscTable.ToDate >= fromDate || !priceDiscTable.ToDate))
#endMacro
In this case you can follow traditional approach.
One small addition here: The use of macros was powerful to also reuse blocks of coding. At compilation the macro part will be inserted in the coding which takes additional compilation time. For this reason, try to avoid use of macros. Microsoft is aiming to get compilations as fast as possible. For this reason, it could be the case that macros will be depreciated in future, but I'm not sure about this.
In addition to performance, macros break a lot of development tooling. If you use macros to insert code blocks, none of the dev tooling can see that code. So things like code upgrade tools, visual studio add-ins, and any future tooling can never understand the macros, since those tools work against code, and macros are not "resolved" (/replaced) until compilation.
Take a look at the video from last years' AX technical conference about the new development environment, where we learned that Macros are Evil in AX 7.
daxioms.blogspot.hu/.../ex-plus-plus-x-for-those-not-into_21.html
Vilmos Kintera Are you able to open this link to watch video - it's not working for me and I am getting error
An error occurred while processing your request.
Reference #97.cf18ae8c.1490135816.7800529
I have checked the central site for conference contents:
mbs.microsoft.com/.../IS_ConferencePresentationsVideos
There is a note there saying they had to remove all videos, and it is available upon request by emailing adocs@microsoft.com
Thanks Vilmos
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 Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 4 Most Valuable Professional
Priya_K 4
MyDynamicsNAV 2