Write budget scripts

The scripting interface allows you to filter the bookkeeping data that will be used in the budget. In a situation where you only have 1 bookkeeping dossier and only 1 budget, you likely won't have to use scripting to determine which bookkeeping data may or may not be used in the budget. But in situations where you have multiple budgets, you will want to filter out all data that does not pertain to that one project or budget.

Graphically, the filtering of the bookkeeping data can be rendered as follows:

The bookkeeping data is first filtered on project level, by the dossiers that are added there. Even if your subscription only contains 1 dossier and 1 project, you must include the dossier in the project.
The resulting data is then evaluated by the budget script to determine which records will not be used in the budget. This means that if there is no script provided, all data of the selected dossier(s) will be part of the budget.

Writing scripts

The programming language that is used to write scripts is JavaScript : it is a powerful programming language that will allow you to write very performant routines.
Although the code you'll write will be quite simple, it is advisable that you learn some JavaScript to be able to create your filtering routines. You'll find a section at the bottom of this page with some useful links.

There are 2 different scripts that can be written for a budget:

  • The line script is executed for each line separately during the processing of the bookkeeping data.
  • The global script is executed once all lines are processed.

Useful links

For general reference, the Mozilla Developer Network is very extensive and well-documented.
To start using operators (like +, ++, =, ==,...), refer to: JavaScript operators
To start using if constructions, refer to: if statement
To start using for loops, refer to: for loop
To know more about regular expressions, refer to: regular expressions on MDN.

To Top