In the previous post, Setting up Dynamics NAV 2018 for Testing and Development in Docker we have covered how to setup a development and testing environment, and had our first steps with Visual Studio Code to publish our first hello world application.
Now I want to show you some AL language thing that might be useful. You can see them in action in the example app ALBasics: https://github.com/TBits/Al-examples/tree/master/ALBasics
There are test procedures illustrating how to:
- Working with basic constructs like “if”
- Format various types of variables to string (known as Text), using Format(), or StrSubstNo().
- Parse Integer to String with Evaluate()
- Working with Date and DateTime, getting the current Now with CurrentDateTime or Today with Today. Comparing dates, even by a given difference in for example days, with CalcDate(). Converting between DateTime and Date, with DT2Time(), and setting a date with DMY2DATE().
- How to work with options: calling a procedure with an option parameter, and the issues you can get if you have different definitions of the options.
- How to call procedures with reference parameters (keyword var), and how to return a result either by a named variable or with exit(
- How to call a procedure that is defined inside a code unit.