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 :
Dynamics 365 Community / Blogs / Dvlprlife.com / Microsoft Dynamics 365 Busi...

Microsoft Dynamics 365 Business Central – AL Conditional Preprocessor Directives

Brad_P Profile Picture Brad_P 1,549

In the AL programming language, preprocessor directives are used to make code conditional, suppress warnings, and enable code expansion and collapse. The AL preprocessor directives are grouped into conditional, regions, and pragmas categories. In this article, I’ll highlight Conditional Preprocessor Directives.

Conditional preprocessor directives are a feature in AL that allows developers to include or exclude parts of the code based on certain conditions. These directives are evaluated at compile-time and help manage different configurations or enable and disable certain features.

A conditional directive checks the value of a symbol to determine if code is included in the compilation. Symbols may be defined at the beginning of a source file to set the Symbol for the scope of that file, or they can be defined in the app.json file for global scope within the extension.

Symbols are defined globally with the preprocessorSymbols setting in the extensions App.json file.

Symbols are defined with the scope of a file with the #define directive at the beginning of a source file. Symbols may also be undefined with the #undef directive, which is useful in the case of a global directive that should not be applied to a specific file.

Read more about the feature Conditional directives here.

Note: The code and information discussed in this article is for informational and demonstration purposes only. This content was created referencing Microsoft Dynamics 365 Business Central 2023 Wave 1 online.


This was originally posted here.

Comments

*This post is locked for comments