Functions in TDL
A function is a small code that accepts a certain number of parameters, performs a task and returns the result. The function may accept zero or more parameters but returns a value to the calling program. The values which a function accepts or the calling program passes to the function are called parameters, and the result which is passed by the function to the calling program is called the Return value.
A function is mainly used for the following purposes:
- Repeating a block of code
- Performing some calculations
- Executing a set of statements
TDL language has a comprehensive set of built-in TDL functions written for specific business requirements. These are referred as in-built or platform-defined functions that can be used by the application developer.
With the introduction of the definition function, the programmer has the capability to create functions as per his requirements and trigger it
as an action or as an in-built function. We will be referring to functions created by the programmer as TDL or user defined functions.
The functions in TDL can be broadly classified into two categories:
- In-built or platform defined functions – These are platform defined and the TDL programmers can call these functions to achieve certain functionality.
- TDL or user-defined functions – These are the functions which are written by TDL programmers based on their requirement.
If a function with the same name exists in the Default TDL source code then the in-built functions always take precedence over the user-defined functions.
Note: Refer the function browser provided along with TallyPrime Developer for detailed documentation on in-built functions.