C/AL
This article includes a list of generalreferences,butit lacks sufficient correspondinginline citations.(December 2009) |
This articlerelies largely or entirely on asingle source.(March 2024) |
Paradigm | Imperative |
---|---|
Designed by | Michael Nielsen |
Developer | Microsoft |
Influenced by | |
Pascal |
C/AL(Client/serverApplicationLanguage) was the programming language used within C/SIDE theClient/ServerIntegratedDevelopmentEnvironment inMicrosoft Dynamics NAV(Formerly known as Navision Attain) andMicrosoft Dynamics 365 Business Centralup until (and including) version 14. It has been replaced byAL.C/AL is a Database specific programming language, and is primarily used for retrieving, inserting and modifying records in aNavisiondatabase. C/AL resembles thePascal languageon which it is based. The original C/AL compiler was written by Michael Nielsen.[1]
Examples[edit]
Hello World[edit]
This is the classicHello Worldexample. Since theC/SIDE(Client/Server Integrated Development Environment) does not have a console to output text, this example is made using a dialog box as the visual interface.
MESSAGE('hello, world!');
Filtering and retrieving record[edit]
Variables in C/AL are not defined through code, but are defined via the variable declaration menu in the C/AL editor. In this exampleItemis assumed to be a variable of type Record.
IFItem.GET('31260210')THEN
MESSAGE(STRSUBSTNO('Item name is: %1',Item.Description));
Item.RESET;
Item.SETRANGE("No.",FromItem,ToItem);
Item.FINDLAST;
Looping and data manipulation[edit]
Looping over a recordset and modifying the individual records is achieved with only a few lines of code.
Item.RESET;
Item.SETRANGE("Blocked",TRUE);
IFItem.FINDSETTHEN
REPEAT
IFItem."Profit% "<20THENBEGIN
Item."Profit% ":=20;
Item.MODIFY(TRUE);
END;
UNTILItem.NEXT=0;
Item.MODIFYALL("Blocked",FALSE);
See also[edit]
References[edit]
- ^Studebaker, David, "Programming Microsoft Dynamics NAV 2009,"p. 8 (2009)
External links[edit]