Methods¶
There are a number of AmiScript methods that can be called within the AMIDB shell tool and throughout the AMI platform to perform different actions.
They can be used in conjunction with Center objects, like triggers, procedures, and timers, to perform complex aggregations or calculations.
3forge also supports the ability for users to write their own custom methods for easy project reusability and maintainability.
SHOW METHODS¶
To view all available methods, use:
These will be returned in alphabetical order. To filter by user-defined methods, run the following command instead:
Note
Custom methods declared in the Web cannot be called within AMIDB. They are separate.
CREATE METHOD¶
To create a custom method, the syntax is as follows:
For example, to create a simple method (called foo) to return the sum of two numbers (of Integer type):
Altneratively, using the optional term IF NOT EXISTS to prevent overwriting an existing custom method is also valid:
This method can now be called/used inside of timers/procedures/triggers, e.g: for a procedure:
Method Overloading¶
Like in Java, 3forge supports method overloading, which allows for methods with the same name but different parameters to be created.
For example, if we currently have int foo(int a, int b), which returns the sum of two Integers, we can overload the method to return the sum of two doubles as well, with:
3forge will auto-resolve the method to use based on the parameters used in the method call.
DROP METHOD¶
To drop the newly created method foo:

