Basics of working with scripts
Product line
Standard
|Expert
Operating mode
CLOUD ABO
|ON-PREMISES
Modules
Services & CRM
Budget & Phases
Purchases
Resource Planning
Business Intelligence
Vertec has included a Python Engine to run custom scripts to control Vertec. A Vertec Python Script allows you to access the entire Vertec Object Model .
For a detailed description of all Vertec Python features, see Vertec Python Features .
And here you will find a Introduction to python programming .
Scripts can either be executed directly (Standard + Expert line) or registered (Expert line):
To run scripts directly in Vertec, there is the Script Editor. Open it via Menu Einstellungen > Script Editor
.
In addition, line-based Python code can be executed in the Python Console. The Python Console opens via Menu Einstellungen > Python Konsole ein-/ausblenden
or via the function key F3
.
A detailed description of the script editor and the Python console can be found in the article The Script Editor .
Scripts that are used repeatedly can be registered in Vertec by using the menu item Aktionen
or in the context menu (right mouse button) directly (line Expert). See the article about registering scripts.
Scripts can also respond to certain events in Vertec (Expert line). If such an event occurs, the script is automatically triggered and executed. Event scripts are particularly useful for customizing recurring processes.
For more information, see Scripts on events .
In Python it is possible to call features from other scripts. Features that are used more often or in several scripts can be outlays into a separate script (Expert line). This script is then a module, the designation of the script the module name.
Scripts are also used as modules for custom renderers and list controllers, as well as for customer-specific adjustments of resource planning and of interfaces (extensions).
For more information, see Scripts as modules .
The Vertec installation comes with various Python modules that allow interaction with the Vertec business logic. They are automatically available after installation. The most important one is called vtcapp and provides several basic features. For the complete list, see Vertec Python Features .
Method/Feature | description | Sample code |
---|---|---|
createobject(class: string) | Creates a new object of the specified class. | leistung=vtcapp.createobject("OffeneLeistung") |
currentlogin(): project editor | Up-to-date registered user | >>> bearbeiter = vtcapp.currentlogin() |
evalocl(expression: string): expressiontype | Evaluate global OCL expression. | projektListe = vtcapp.evalocl("Projekt.allinstances->orderby(code)") |
evalocl evaluates an Ocl expression on an object or on a list of objects.
Beispiel: # Rechnung obj = argobject Leistungen = obj.evalocl("leistungen") # Summe von Leistungen SummeLeistungen = Leistungen.evalocl("if self->first.rechnung.verrechnet then\ oclastype(VerrechneteLeistung).wertext else oclastype(OffeneLeistung).wertext endif->sum")
Global OCL variables (that is, those that refer to the entire vertec and not to a single object or list) are evaluated via vtcapp.evalocl
(see The vtcapp module above).