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)

Question about [] in X++

(0) ShareShare
ReportReport
Posted on by

I started learning AX today, and I saw an example:

[
DataContractAttribute,
SysOperationContractProcessingAttribute(
classStr(HW_Apgiam_UI),
SysOperationDataContractProcessingMode::
CreateUIBuilderForRootContractOnly)
]

class HW_Apgiam_CT implements SysOperationInitializable
{
    Str1260   companycode;
   // StartDate fromDate;
    EndDate toDate;
    Str1260 mainAccountId;
    Str1260 vendAccount;
    CurrencyCode currency;
}


and 

[
    DataMemberAttribute("CompanyCode"),
    SysOperationLabelAttribute(literalstr("Company Code :"))
]
public Str1260 parmCompany(Str1260 _companycode = companycode)
{
    companycode = _companycode;

    return companycode;
}

Can anyone tell me the code inside "[]" can do, I can not find out the answer on the internet.

Thanks.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,394 Most Valuable Professional on at
    RE: Question about [] in X++

    The things inside [ ] are "attributes".

    They're used to add additional information to classes and methods. In your example, attributes say that the class is a data contract (AX knows how to serialize data contract classes), that there is another class (HW_Apgiam_UI) that should be used for generating a dialog for this contract, which label should be used in the dialog for Company and so on.

    By the way, the value of SysOperationLabelAttribute is wrong. It should be a label ID, so there may be translations to other languages. It also shouldn't suffixed with " :".

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans