Banana (Objects)

Diese Dokumentation ist veraltet

Die umfangreichste und aktuellste Dokumentation ist die von Banana Buchhaltung Plus: Probieren Sie es sofort aus!

In this article

Banana is the namespace (object) through which all Banana script's methods, class and objects are accessible.


The object Banana.application represent the running application.


The object Banana.console is used to sent message to the debug the script.


The class Banana.Converter contains methods useful to convert data from and to various formats.


The object Banana.document represent the current document opened in the application. It contains base properties and methods, see Banana.Document (Base), and if the document represent an accounting document it contains additional accounting's properties and methods, see Banana.Document (Accounting). If any document is opened this object is of type Undefined.


The class Banana.IO is used to read and write files.


The class Banana.Report enable you to create reports, preview and print them in Banana Accounting.


The object Banana.script is used to get informations about the running script.


The class Banana.SDecimal contains methods useful to do decimal math calculation.


The class Banana.Ui contains predefined dialogs to interact with the user, and methods to load dialogs from .ui or .qml files.


The class Banana.Xml contains methods to parse and access Xml data.

Banana Methods

Banana.compareVersion(v1, v2)

Compare two version strings. Versions string are in the form of "x.y.w.z". Returns 0 if v1 and v2 are equal, -1 if v2 is later and 1 if v1 is later.

Since: Banana Accounting 8.0.5

var requiredVersion = "8.0.5";
if (Banana.compareVersion && Banana.compareVersion(Banana.application.version, requiredVersion) >= 0)
   Banana.Ui.showInformation("Message", "More recent or equal than version " + requiredVersion);
   Banana.Ui.showInformation("Message", "Older than version " + requiredVersion);


The method Banana.include(path) include a javascript file evaluating it.
If an error occour, i.e. the file is not found or is not valid, the method throws an exception.

The path is relative to the current script being executed, if no protocol is specified. Otherwise depending on the protocol it can be relative to the main script's folder, the document's folder or the name of a document attacched to the current file.
- <relative_path_to_current_script>/<file_name>
- file:script/<relative_path_to_main_script>/<file_name>
- file:document/<relative_path_to_file>/<file_name>
- documents:<attachment_name>

Scripst included though the method Banana.include(path) can include other scripts trhough the method Banana.include(path), but not via the script's attibute @includejs. The method Banana.include(path) garantees that each distinct script is evaluated once, even if it is included more than one time from differents scripts. Path can contain ".." (parent folder), in the case the destination path is outside the main script's folder, the method will throw a security exception.

Since: Banana Accounting 8.0.5



Diesen Artikel teilen: Twitter | Facebook | LinkedIn | Email