Using AmiScript¶
AmiScript is 3forge's inbuilt scripting language incorporating both Java and SQL-like syntax. AmiScript allows developers to design and build dashboards for complex data handling using familiar syntax.
This page details several tools for AmiScript to streamline development.
Custom Methods¶
Custom Methods are user-defined methods that can be used anywhere throughout a layout. This is useful for maintaining readable code and for repeating logic.
To view and create your custom methods, go to Dashboard -> Custom Methods. An example is also listed below.
Note
- Each method should be contained in its own nested block (
{}). - Each method must have a
;after its definition. - Methods can be overloaded -- the same method name can be used if it has a different input definition.
- AMIDB methods cannot be called from Web. They are distinct from one another.
Example¶
This custom method block declares three methods:
-
sum()- summing two integers
-
sum()- an overloaded sum that takes two doubles
-
flatten()- flattening a list
Pasting them into 3forge's Custom Methods window will look like this:
Then, in any window that takes AmiScript, call the methods as you would any standard AmiScript method:
Debugging¶
Any portion of AmiScript can be debugged using breakpoints:
-
Add a new breakpoint by clicking on the line number of the line you would like to debug.
-
Enter Debug Mode by pressing the "test" button.
-
Action once your breakpoint has been hit, use the Debugger tab at the bottom of the screen to understand the state of your code, when done press "continue" to advance to the next breakpoint
Embedding Python¶
3forge makes use of Jython to use Python libraries within 3forge.
Note
This functionality is not widely available. If you require this for your use case, we strongly recommend contacting us at support@3forge.com first.
Loading Python Modules in AmiScript¶
To import Python modules, use an extern block:
You can then use standard Python syntax in the extern block.
By default 3forge looks for Python Libraries in the amione/lib directory of your 3forge installation.
Alternatively, you can also set the JYTHONPATH environment variable and 3forge will load libraries from there.
Using Python in AmiScript¶
Below is an example of how you can pass in variables and tables and modify and return them using Python:




