To create an application in Microsoft Dynamics NAV, you must make database objects work together. You can use C/AL code to bind all the database objects together to form a unified whole.

When you design professional applications you often need specialized functions. C/AL lets you create functions that extend the functionality of C/SIDE. You can create special functions for use anywhere in the database.

C/AL enables you to:

Designing Your Own Functions

Although C/SIDE has many built-in functions, you may need or want to create your own functions. For example, you will need to develop your own functions when the application that you develop repeatedly uses the same nontrivial processing.

We recommend the following guidelines for when to create new functions and when to create parameters and local variables for a function:

  • Do not move a piece of code to a new function unless either the code is nontrivial and the new function is afterwards called from more than one place, or the move is required to keep the code clear and manageable.

  • Create only parameters that are necessary for the function to operate on different data, depending on where it is called from. If a function also changes a global variable, however, then we recommend that you transfer the global variable to the function to indicate that the function will change this variable.

  • Use additional local variables in the same way that you would use them in other development languages and environments.

  • When you create a user-defined function, we recommend that you set the Local property to Yes unless you want to access the function from outside the object. This makes the code easier to understand because it is clear that the function is not referenced from other objects.

See Also