Zoho Creator : ‘Function’ support in Deluge scripting

With the recent update in Zoho Creator, we have enriched the deluge language with ‘Functions’ support.

Let’s see, ‘What is Function’ in scripting terminology. In simple terms, ‘A function is a set of statements grouped together under a name and can be invoked/reused from elsewhere in the scripting‘.

Usage of functions can be broadly classified under the following.
1).Write once and reuse utilities
2).Serves as bridge between applications (created by the same user)
3).Custom action integration in views

Write once and reuse utilities :

‘Functions’ promotes 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 application, you can define them as separate 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.

eg:

  bool isLeapYear(int year)
{
leapyear = false;
if ((input.year % 4) == 0)
{
leapyear = true;
if(((input.year % 100) == 0) && ((input.year % 100) != 0))
{
leapyear = false;
}
}
return leapyear;
}

Help on creating a new function here

More samples here

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, which 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 Zoho 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 specific function on a selected record in a view.

Custom actions in a view in live mode

More help on custom action in views

– Hariharan

Comments

2 Replies to Zoho Creator : ‘Function’ support in Deluge scripting

Leave a Reply

Your email address will not be published.

The comment language code.
By submitting this form, you agree to the processing of personal data according to our Privacy Policy.

Related Posts