Maple Engine

Last Updated: 2023-11-04 06:02:43
The last thing we need to discuss are Maple functions. As discussed previously, a function is a unit of code which performs actions to accomplish a specific task.  A Maple function will always accept one parameter and always returns a value.
    
Maple functions are identified by a name and brackets and are defined as FUNCTION( PARAMETER ) where FUNCTION is the maple function name and PARAMETER is a variable passed to it.  Below is a list of available functions.

length
This function returns the number of characters in a textual value or the number if collections in a
list.  It's implemented as follows.
length( myVariable )

count
This function is an alias for length and is available for context. It's implemented as follows.
count( myVariable )

defined
This function evaluates whether a variable or collection variable is present with the current website
templates dataset. It's implemented as follows.
defined( myVariable )

show
This function converts a variable or list of collections into HTML for display purposes.  It allows you to
explore a variable content and is most commonly for lists and collection keys.  It's implemented as follows.
show( myVariable )

json
This function converts a variable or list of collections into a JSON string for JavaScript.  This makes it
possible to perform JavaScript operations on a dataset. It's implemented as follows.
json( myVariable )

Note: A JSON string cannot be converted back to a template variable.
Was this page helpful?