The functions defined in the Functions tab can be called and executed from form/field action scripts. You can call a function directly from the Call Function deluge statement or from User Defined Function tab in expression builder, based on your requirement.
To call a function directly,
Click Done to update the changes. The function display is called in the On success script with the input.ID as value of argument a.
When an entry is added to the form, the display function will be called which will display the record ID of the current record as a log message.
Let us define a CalculateDays function to calculate the number of dates within two date Fields. The function has two arguments sdate and edata of type date with return type int, as shown below:
Now, we will call this function from the On Add -> On Success -> Set Variable statement -> User Defined Function tab in expression builder. The Set variable statement will set the Number_of_days field in the Sampleform with the value of days returned by the CalculateDays function. The arguments sdate and edate is replaced with the Input Fields Start_Date and End_Date.
When a record is submitted in the SampleForm, the on add -> on success script is invoked, which executes the CalculateDays function and updates the Number_of_days field with the value returned by the function.