Variables Declarations Order
Categories:
Created by Microsoft, Described by waldo
Description
Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be:
- Record
- Report
- Codeunit
- XmlPort
- Page
- Query
- Notification
- BigText
- DateFormula
- RecordId
- RecordRef
- FieldRef
- FilterPageBuilder
(Ref: Microsoft Docs)
Bad code
StartingDateFilter: Text;
Vendor: Record Vendor;
Good code
Vendor: Record Vendor;
StartingDateFilter: Text;
Tips
The AZ AL Dev Tools/AL Code Outline extension adds two new commands to Visual Studio Code to sorts variables.
Sort Variables in the Active Editor
: sorts variables in the current editorSort Variables in the Active Project
: sorts variables in the current project
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.
Last modified October 4, 2024: Merge pull request #249 from Busschers/ErrorHandling-ListOfReferenceText (5e76983)
by Arend-Jan Kauffmann