Centralize Python code for Office reports

Centralize Python code for reuse in Office reports

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 25.09.2020
Machine translated
Updated: 01.12.2022 | Adapted to Vertec version 6.6.

If you want to centralize Python code for office reports , i.e. use the same code base for several report templates, you can do this as follows:

Creating a script entry

Create a script entry. It will be registered without class specification and without event specification. The designation must not contain spaces. Here in the example we call it report_code, but you can choose the designation as you like.

Paste the Python code of the Office report in the Script Text field.

In order for the script to know the reporting framework, the following modules must also be imported:

import vtcapp
from reporting.table import Table
from reporting.fields import *

It looks like this:

Import code in the Office report

The code is then imported into the Office report:

from report_code import *

If extended user rights are required, check the Office report where the script code will be imported.