In simple terms, a function is a set of statements grouped together under a name and can be invoked from anywhere within a program. Deluge Scripting supports Functions, using which we can structure the deluge script in a more modular way, accessing all the potential that structured programming can offer. Related functions can also be grouped under a common category based on their purpose, called namespace, which helps in easy maintenance. Functions can be invoked from form/field action scripts or on selected records in a view.
- A function calling itself (also known as recursive function) cannot be called more than 75 times. If the limit of 75 is crossed, it throws an error "Call Stack limit exceeded".
Advantages of using Deluge Functions
Write once and reuse utilities
‘Functions’ promote code re-usability of deluge script within an application and even across applications (same user’s applications). It makes the code modular and easy to understand. When you feel like repeating certain scripting functionality across different parts of an application, you can define them as a function and reuse it. With the help of built-in functions provided in deluge, you can create numerous util functions on your own, using the ‘Functions’ support.
Serves as bridge between applications (created by the same user)
Not only can you define generic utilities as functions, you can even manipulate the application data from within the functions. Till now, it was not possible to manipulate the data in one application from the script in another application. This is now made possible with the help of functions. In this respect, we can consider application as an object with its data and we can define functions to operate on this data which compares to member functions in an ‘object oriented’ world. The applications can communicate with each other using functions.
Custom action integration in views
‘Functions’ has the potential to be integrated into various GUI actions, taking the scripting integration in SkyDesk Creator to next level. It makes the applications created, much more powerful and alive. As a first step, it is integrated into views under the terminology ‘Custom Actions’. It enables the user to invoke a specific function on selected records in a view.