Functions- Documentation

Last updated: 09-Dec-2021

Overview

Functions are used to create custom scripts to accomplish specific and highly customised functionality using a programming language of your choice.

Results of a function can be returned as text or preformatted on the server and returned as a PDF document. A function results can also be emailed directly to an address when the function is called.

You can connect to your Sphere ERP databases or other databases from functions and even invoke cURL to connect to external services.

Functions PDF config

If a function is intended to be able to return a PDF document, the document properties such as paper sizes and margins can be configured using the properties below.

{
    "title": "string or SQL query that returns a string",
    "orientation": "landscape/portrait (default=portrait)",
    "page_width": "with units eg 10mm (default=A4 paper width)",
    "page_height": "with units eg 10mm (default=A4 paper height)",
    "p_margin_top": "with units eg 10mm",
    "p_margin_bottom": "with units eg 10mm",
    "p_margin_left": "with units eg 10mm",
    "p_margin_right": "with units eg 10mm",
    "render_delay": "in microseconds eg 200 (default=200)",
    "user_inputs": "< object like chart inputs >",
    "run_options": {
        "inapp": "Run in app",
        "htm": "View HTM",
        "newtab": "New tab",
        "pdf": "View PDF",
        "mail": "Email PDF"
    }
}