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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ symbol primer wanted

(0) ShareShare
ReportReport
Posted on by

Hello,

I know, total newb question but here it goes. I'm looking for a source to help me understand the X++ reserved keywords and symbols (e.g., @, #). I've looked over this source ...

msdn.microsoft.com/.../aa661012.aspx

... but there isn't much in practical examples. I'd say I'd emphasize the symbols more than the keywords. Reason is I see sample codes and the AX X++ code often use these symbols but I'm often totally confused on how they're used.

Thank you!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rudi Hansen Profile Picture
    4,075 on at

    Hmm that article you found actually explains the symbols pretty well.

    If you are looking for example code, you really just have to search the existing AX code base for them.

    Go to the AOT Properly just classes node, and press Ctrl+F and put what you are looking for in the "Containing Text" field.

    If you are looking for Symbols like @ you have to use \ before each of them for the search to work, like if you want to search for && you but in \&\&

    Also sometimes doing a Google search for Dynamics AX "&&" (On Google put the symbols between quotes) will also help, but granted on symbols it might be a little hard to find the right things.

    Hope this helps, if not you are welcome to ask here for the specific symbol you are having problems with.

  • Community Member Profile Picture
    on at

    Hi Rudi,

    Thank you for the suggestions. The one that often throws me is the hash character (#). The example from the link makes sense when I read it but I've seen in sample codes where the hash is used with the "define" keyword. It appears to denote a constant? Would you be able to point me to some simple examples of its use?

    Much appreciated.

  • Suggested answer
    Community Member Profile Picture
    on at

    msdn.microsoft.com/.../aa661012.aspx  for keywords

    msdn.microsoft.com/.../aa856741.aspx  for functions

  • Verified answer
    Rudi Hansen Profile Picture
    4,075 on at

     I understand your confusion, the hash character (#) is used for creating what they call macros in AX. And it is mostly used for constants as you might have figured.

    So there should be plenty of examples in all the Macros in the AOT.

    But the idea is that you can make a macro/constant like this.

    #define.io_write('W')

    And the you can use it in your code like this.

    file = new BinaryIo(_filename, #io_write);

    I think the reason they are still called macro, is dating back to the "old" Dynamics XAL, where macros where the functions of that language. And when they made Dynamics AX they kept the macros in the language, to keep a little backwards compatibly with Dynamics XAL.
    But I am not sure if there are still some Macros left in Dynamics AX with some of the more advanced functions.

    Hope this helps you a little.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Just for reference, macros are explained in great detail on MSDN: Macros in X++ [AX 2012]. I think that most AX developers don't actually know all of that...

    I'm pretty sure that X++ macros have been inspired by C++ preprocessor macros.

  • Suggested answer
    Rudi Hansen Profile Picture
    4,075 on at

    So that leaves the question, was AX inspired by XAL witch was inspired by C++, or was AX inspired directly from C++?? :-)

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans