Vertec COM Interface

Address Vertec via COM Proxy from outside

The Vertec Desktop App and Cloud App can be accessed via the Vertec COM Interface and thus remotely controlled by another software running under Windows (especially all locally installed Microsoft Office apps).

The Difference between desktop app and cloud app is that the Cloud App offers a local COM server, although there is no business logic at all. This is simulated with a COM proxy to the actual COM server running on the server in the Vertec session. The traffic runs over the normal data connection and is therefore not suitable for data migrations or larger amounts of data.

Depending on whether the Desktop App (local COM server) or the Cloud App (proxy for connection to the COM server) is accessed via COM, the interfaces have different names. Since the Desktop App will be discontinued in the future and can also be accessed via the COM proxy, the COM proxy interfaces are described here. See also: Switch COM to COM Proxy and COM Forwarding.

All examples are written in Visual Basic.

ComCoClass

This is the default interface of the Vertec COM server. CreateObject("Vertec.App") returns a session reference as a result.

Dim Vertec As Object
Set Vertec = CreateObject("Vertec.App")

Based on this, the Vertec objects can then be requested.

The ComCoClass has the following features:

Feature / feature description
ArgObject

Returns the current object (current entry) in Vertec. This is the entry selected as the main entry in the active Vertec window.

The type of the returned interface corresponds to the type of the current object.

BeginSystemContext / EndSystemContext
Switches Vertec to extended user rights within these two commands. Can only be applied via COM if Vertec was started with the parameter /SUPER and the administrator is logged in. Otherwise the call will result in an error.
CreateList(classname as string)

Creates a new blank Vertec list for entries of the specified type (classname).

Set Projektbearbeiter = Vertec.ArgObject
Set ObjectList = Vertec.CreateList("Projektbearbeiter")
ObjectList.Add Projektbearbeiter
CreateObject(classname as string)
Creates a new object in Vertec. The class name of the object must be passed as a parameter. As a result, the feature returns an interface reference of the newly created object.
DisableEvents / EnableEvents
Temporarily turns off the Event Script system. Can only be used via COM if Vertec was started with the parameter /SUPER and the administrator is logged in. Otherwise the call will result in an error.
Eval(expression as string)

This feature evaluates any OCL expression. The result is returned as a variant and can be interpreted as a string, integer, float, boolean, or object, depending on the OCL expression.

EvalToVariable(root as object, expression as string, varname as string)

This allows values to be loaded into variables, which can then be used in OCL expressions.

For example, you want to show services from a certain point in time. Instead of searching for services in the type “openperformance->select(date >=” & encodeDate(2023, 03, 01) & “) “, you can first set a variable:

Vertec.EvalToVariable Vertec.ArgObject, "encodeDate(2023,03,01)", "varVon"

and then used in OCL:

offeneLeistungen->select(datum >= varVon)

The expression is evaluated on the specified root object, so it can also be an expression of the type:

Vertec.EvalToVariable Vertec.ArgObject, "projekt.rechnungen->reject(proforma)", "Rechlist"

can be specified.

ExecuteFileReport
(templatepath As String,
rootObj As object,
[optarg As object],
[filename As String],
[subject As String],
[text As String],
[linkToRoot As Boolean = False], [linkToOptarg As Boolean = False],
[showWord As Boolean = True]) As Object

This feature can only be used in conjunction with the Desktop App. It allows you to call up a Legacy Office Report.

  • templatepath: path to the template.
  • rootObj: The Vertec object to run the report on.
  • optarg: Matches the optional address on the print dialog. Optional argument. If not used, specify parameters with nothing.
  • filename: The path to the newly created document. Optional. Can be specified as an absolute path or as a filename (relative, uses the rootObj’s DocPath as path). If nothing is specified, the document will not be saved. The linkToRoot and linkToOptarg parameters can only be used if the document is saved.
  • subject: Corresponds to the subject of the print dialog. Optional.
  • text: Correspond to the comment on the print dialog. Optional.
  • linkToRoot: Links the document to the main object (check Auf Hauptobjekt on the print dialog). Optional. Default: No. Linking can only be done when the report is printed (see parameter filename).
  • linkToOptarg: Links the document to its address (check Auf Adresse on the print dialog). Optional. Default: No. The link can only be made when the report is printed (see parameter filename).
  • showWord: Opens the created document in Word and displays it on the screen. Optional. Default: Yes.

Example call with all parameters:

Set Vertec = CreateObject("Vertec.App")
Set Projekt = Vertec.ArgObject

Set Dok = Vertec.ExecuteFileReport("V:\Reports\Brief.dotx", Projekt, Nothing, "Brief.docx", "", "", True, False, True)

To print the document, you can

Dok.PrintOut

can be called up.

GetObjectByID(ID: String or int)

Returns the Vertec object with the corresponding ID. The ID must be the Internal Id ID of the object, either as a string or as an integer.

Set Obj = Vertec.GetObjectByID(2880)
Set Obj = Vertec.GetObjectByID("2880")

If no object with this ID exists, an error is thrown.

GetWithSQL(className as String, SQLWhere as String, SQLOrder as String)

Returns the result of a SQL query on a given Vertec class. This means that SQL selects all objects of a given class according to the specified criteria (SQL Select, Where Clause) and returns it as a list.

The executing user must have administrator rights or the SQL Query right.

Unlike Eval, only the objects that match the SQL condition are loaded from the database. Example:

Dim List as Object
Set List = Vertec.GetWithSQL("adresseintrag", "name like 'A%'", "name")
InputBox (Title as String, Prompt as String, Default as String): String

Displays an input dialog with title, prompt text and input field with default value.

  • Title: The title of the input box. If you DON’T want the input box to have a title, specify a blank string.
  • Prompt: The text to be shown
  • Default: The text to be shown as the default answer in the field. If you want the input field to be blank, enter a blank string here.
Wert = Vertec.InputBox("Vertec", "Wie lautet Ihr Name?", "")

Return values:

  • If the user OK clicks (or Enter presses), the content of the text box is returned.
  • If the user Abbrechen clicks, an empty string is returned. So it is not possible to distinguish whether the user has not entered anything or has canceled.
MsgBox (Prompt as String, [Button as int], [Title as String]): integer

Displays a message box.

  • Prompt: The message to be shown.
  • Buttons: optional. Default: 0. An integer value as follows:
    0 OK
    1 OK, Cancel
    3 Yes, No, Cancel
    4 Yes, No
    16 Critical Message: red X and OK button
    48 Warning: yellow exclamation mark and OK button
    64 Information: Blue I and OK button
  • Title: optional. Default: Empty. Title of the message box.
Vertec.MsgBox "Dies ist mein Text.", 1, "Titel"

The return value indicates which button was clicked. This is one of the following integer values:

1 OK
2 Cancel
6 Yes
7 No

 If a value is queried, the feature must be called with a parenthesis:

Wert = Vertec.MsgBox ("Dies ist mein Text.", 1, "Vertec")
If Wert = 1 then
    ...
ScriptExecute(scripttext As String, argobject As Object)
 

Allows you to invoke a Vertec script. The executing user must have administrator rights or permission to execute this script.

  • scripttext: The code is passed as scripttext. This can be the text of a script registered in Vertec or a code text.
  • argobject: This parameter allows you to specify the object on which the script should be executed.
Dim Script As Object
Dim Bearbeiter As Object
Dim Scripttext As String

Set Bearbeiter = Vertec.User
Set Script = Vertec.ArgObject
Scripttext = Script.Member("scripttext")
Vertec.ScriptExecute (Scripttext, Bearbeiter)
SetObjVariable(variable name, value)

Sets an object variable in OCL. Example:

Vertec.SetObjVariable "myProjekt", proj

These can then be accessed in OCL expressions via variable name:

offeneLeistungen->select(projekt=myProjekt)->size

The difference to EvalToVariable (see above) is that it simply passes an object without evaluating an expression.

user, project, phase, date, intervalTyp, value)

Allows the setting of resource plan values via script.

  • Users: Project users on which resources are scheduled. Do not work with Planning Editors.
  • Project: If the is set to Project: The project to which you plan. Otherwise: Nothing.
  • phase: If the Planning Level is set to phase: The project phase to which the planning is planned. Otherwise: Nothing.
  • date: The period in which the date is located is taken.
  • intervalTyp: No longer considered in Vertec 6.6, because the planning interval is fixed and is always removed from the system settings. Before: 0 = day, 1 = week, 2 = month.
  • value: Value in minutes
Set Projektbearbeiter = Vertec.User
Set Projekt = Vertec.ArgObject

Vertec.SetResourcePlanValue Projektbearbeiter, Projekt, Nothing, Vertec.Eval("encodeDate(2023,04,24)"), 0, 540
ShowForm(obj As Object)

Method to call the details window of the Vertec object passed as argument.

Note that this changes the ArgObject, i.e. the current object in Vertec.

Vertec.ShowForm Projekt
Translate(text As String) As String

Translates a text into the current interface language.

Wert = Vertec.Translate("Projektbearbeiter")
UpdateDatabase

Vertec.UpdateDatabase writes all unsaved data to the database.

Saves changes to the database and validates newly created objects. If they do not violate any rules, they will no longer be invalid.

User

Returns the current logged in users.

VtcObjectProxy

This is the default interface for all Vertec objects.

For certain objects such as projects, invoices, etc. are additionally defined own interfaces, which inherit from VtcObjectProxy (the properties and features of VtcObjectProxy are also present there) and extend it by separate properties.

Feature / feature description
AddTag(Tagname as String)

Adds a tag to the object.

Set Projektbearbeiter = Vertec.User
Projektbearbeiter.AddTag "mytag"

Can be removed with RemoveTag(name).

AsString

Returns the string representation of the object as a string.

Set Projektbearbeiter = Vertec.User
Debug.Print Projektbearbeiter.AsString

-> Christoph Keller

ClassName

Returns the class name of the object as a string.

Set Projektbearbeiter = Vertec.User
Debug.Print Projektbearbeiter.ClassName

-> User

Delete

Deletes the object in Vertec. Return an error if the logged in user does not authorize to delete.

Set Obj = Vertec.ArgObject
Obj.Delete
Eval(expression as string)

Evaluates an OCL expression on the object. Unlike Eval, which is called on the session (ComCoClass), here the expression is applied directly to the object.

Dim Projektbearbeiter as Object
Dim Projektliste as Object

Set Projektbearbeiter = Vertec.User
Set Projektliste = Projektbearbeiter.Eval("eigProjekte")
EvalAsString(expression as string)

Same as Eval, but directly returns the string representation of the result.

Dim Projektbearbeiter as Object
Dim Wert as String

Set Projektbearbeiter = Vertec.User
Wert = Projektbearbeiter.EvalAsString("stufe")
GetMLValue(Index, Language As String) As String
 

If are present on the object as Multi-Language Strings (MLStrings), they can be queried in the other languages using this method.

  • Index: Name of the member
  • Language: The respective language code (DE, DD, FR, IT, EN, NL).
Set Taetigkeit = Leistung.Eval("typ")
Wert = Taetigkeit.GetMLValue("text", "EN")

Query via Member (Taetigkeit.Member("text")) always returns the value in the current interface language.

The MLStrings are set via SetMLValue.

HasTag(tag As String) As Boolean

Queries whether a specific tag exists on the object.

If Projektbearbeiter.HasTag("mytag") Then
    'Do Something
End If

The return value is 1 (True) or 0 (False).

IsOfType(typeName As String) As Boolean
 

Specifies whether the object is of the specified type (class name). Example:

Set Obj = Vertec.ArgObject
If Obj.IsOfType("Adresseintrag") Then
  Debug.Print "Ist ein Adresseintrag"
End If
If Obj.IsOfType("Person") Then
  Debug.Print "Ist sogar eine Person"
End If

As you can see in the example, the entire tree is considered, including the base classes.

LinkTo(target As Object, Role As String)

Makes a link (via Custom Link Type) from the object to the target object (target) with the specified Role.

  • target: The object to which the current object should be linked
  • role: The Desired Role can be specified in two ways:
    • The designation of the link role on the corresponding link type.
    • The entry ID of the link type, followed by _A or _B depending on the page of the link role.
Set Person = Vertec.GetObjectById(3045)
Set Firma = Vertec.GetObjectById(3174)

Person.LinkTo Firma, "VR-Mandate"
'oder
Person.LinkTo Firma, "vrlinktyp_A" 

With Unlink, the link can be unlinked again.

For detailed information, see the article Operators and methods for links.

Member(membername: string)

Read access to the member with the specified name. This can be both an attribute and a link (object or object list).

Set Projekt = Vertec.ArgObject
Set Kunde = Projekt.Member("kunde")
Nummer = Kunde.Member("standardtelefon")

SetMember is used for write access.

MemberCount (As Long)

Returns the quantity of members of a Vertec object.

MemberWithSQL(membName As String, sqlWhere As String, sqlOrder As String) As VtcObjectListProxy

Allows to load only a selection of linked objects with persistent Multilink members via SQL filter.

The executing user must have administrator rights or the SQL Query right.

Dim Projekt As Object
Dim Rechlist As Object

Set Projekt = Vertec.Argobject
Set Rechlist = Projekt.MemberWithSQL("rechnungen", "datum between '01.01.2023' and '31.03.2023'", "nummer")
RemoveTag(Tagname as String)

Removes a tag from the object.

Set Projektbearbeiter = Vertec.User
Projektbearbeiter.RemoveTag "mytag"

Tags can be added with AddTag(Name).

SetKeyValue(key As String, Value)

Sets a key value on the object.

Set Projektbearbeiter = Vertec.User
Projektbearbeiter.SetKeyValue "Datum", Date
Projektbearbeiter.SetKeyValue "Checked", True

There is no separate method for querying key values, but it is done via OCL:

Dim Datum As Date
Dim Checked As Boolean
Datum = Projektbearbeiter.Eval("keydate('Datum')")
Checked = Projektbearbeiter.Eval("keybool('Checked')")

The remove of a key value is done by setting the corresponding key with Nothing or Leerstring:

Projektbearbeiter.SetKeyValue "Datum", Nothing
Projektbearbeiter.SetKeyValue "Checked", ""
SetMember(membername, value)

Writes the passed value to the member of the specified name. The value can be either an attribute or a link (object).

Set Projektbearbeiter = Vertec.User
Set Adresse = Vertec.ArgObject
Adresse.SetMember "betreuer", Projektbearbeiter
Adresse.SetMember "bemerkung", "Betreuer hinzugefügt"

Member(Name) is used for read access.

SetMemberOutOfDate
(membername as string)

The method sets a specific member “out of date,” so that the database is accessed again on the next access and so the current value is in it.

Use case: with self-built number generators, call “SetMemberOutOfDate” before accessing a member, then e.g. count up one, then immediately call “UpdataDatabase,” then the probability is small that the same number is assigned twice.

The method can also be used on derived attributes to trigger a new computation without any changes (as is the case with derived attributes).

SetMLValue(Index, Value As String, Language As String)
 

Sets Texts as multi-language strings (mlstrings) in the different languages.

  • Index: Name of the member
  • Value: Value that the member should receive
  • Language: The respective language code (DE, DD, FR, IT, EN).
Taetigkeit.SetMLValue("text", "Vacanze", "IT")

The MLStrings are queried via GetMLValue.

SetAdditional Field(Name As String, Value As String)

Sets the value of the custom with its name as a string. Cannot be used for object extension fields.

For field types <> Zeichen or Text the string must be passed appropriately for the field type (numbers “0” or “0.00,” Boolean “0” or “1,” etc.) or setadditional fieldAsVariant.

For additional selection fields, the string value is passed.

Set Adresse = Vertec.ArgObject
Adresse.SetZusatzfeld "Druckoption", "Alles" 
Adresse.SetZusatzfeld "Checked", "1"
Adresse.SetZusatzfeld "Anmerkungen", "Kontrolliert"

The custom field items are queried via custom field item) or additional fieldAsVariant(name).

SetAdditional fieldAsVariant(Name As String, Value)

 Sets the value of the custom item with the corresponding name as a variant. Can be used for all extension field types. Custom Field Items

In the case of additional selection fields, the value can be passed as a string or as an integer.

Set Adresse = Vertec.GetObjectById(3174)
Adresse.SetZusatzfeldAsVariant "Druckoption", 1
Adresse.SetZusatzfeldAsVariant "Checked", True
Adresse.SetZusatzfeldAsVariant "Anmerkungen", "Kontrolliert"
Set Bericht = Vertec.GetObjectById(51371)
Adresse.SetZusatzfeldAsVariant "Adressbericht", Bericht

The custom field items are queried via custom field item) or additional fieldAsVariant(name).

Unlink(target: Object; Role: String)

Removes a link to the passed object with the specified Role.

Set Person = Vertec.GetObjectById(3045) 
Set Firma = Vertec.GetObjectById(3174) 
Person.Unlink Firma, "VR-Mandate"

Note for custom links: If deletion forwarding is configured, the link cannot be resolved using this method. Such a link can only be resolved by deleting one of the link partner objects.

Links can be created with LinkTo.

For detailed information, see the article Operators and methods for links.

UnloadObject

Removes the object from Vertec object storage. Must be used with caution, as subsequent accesses to the unloaded object may result in errors.

Zusatzfeld(custom field name as string)

Read access to the custom field item. Return the value as a string regardless of type (equivalent to the OCL query extension additional field asstring).

If an additional custom field item has the value NULL, an empty string is returned.

For additional selection fields, the string value is supplied.

Dim Druckoption As String
Dim Checked As String
Dim Anmerkung As String
Dim Bericht As String

Druckoption = Adresse.Zusatzfeld("Druckoption")
Checked = Adresse.Zusatzfeld("Checked")
Anmerkung = Adresse.Zusatzfeld("Anmerkungen")
Bericht = Adresse.Zusatzfeld("Adressbericht")

Custom field items are written with setadditional field or setadditional fieldAsVariant.

ZusatzfeldAsVariant
(custom field name as string)

Read access to the custom field item. Return the value depending on the type.    

If an custom field item has the value NULL, the default value for the field type is returned (numbers 0 or 0.00, string ““).

For additional selection fields, the integer value is returned.

Dim Druckoption As Integer
Dim Checked As Boolean
Dim Anmerkung As String
Dim Bericht As Object

Druckoption = Adresse.ZusatzfeldAsVariant("Druckoption")
Checked = Adresse.ZusatzfeldAsVariant("Checked")
Anmerkung = Adresse.ZusatzfeldAsVariant("Anmerkungen")
Set Bericht = Adresse.ZusatzfeldAsVariant("Adressbericht")

Custom field items are written with setadditional field or setadditional fieldAsVariant.

VtcObjectListProxy

All list results (e.g. return values of Eval, Member etc.) are represented by a VtcObjectListProxy interface. This has the following properties:

Feature / feature description
Add(obj As Object)

Inserts an object into the list:

Set Projektbearbeiter = Vertec.User
Set Bearbeiterlist = Vertec.CreateList("Projektbearbeiter")

Bearbeiterlist.Add Projektbearbeiter

If the list is a link member of a Vertec object, a new link is effectively created:

Set Benutzergruppe = Vertec.ArgObject
Set Bearbeiterlist = Benutzergruppe.Eval("benutzer")

Bearbeiterlist.Add Projektbearbeiter
AddList(list As Object)

Adds the passed list to the current list.

Set Benutzergruppe = Vertec.ArgObject
Set Benutzerlist = Benutzergruppe.Eval("benutzer")
Set Bearbeiterlist = Vertec.GetWithSQL("projektbearbeiter", "bold_id IN (Select Projektleiter FROM Projekt)", "name")

Benutzerlist.AddList Bearbeiterlist
Count As Long
Quantity of objects in the list.
Eval(expression As String)

Evaluates the specified OCL expression in the list.

Set Projektbearbeiter = Vertec.User
Set Leistlist = Projektbearbeiter.Eval("offeneLeistungen")
Vertec.SetObjVariable "aktBearb", Projektbearbeiter

Set Projektliste = Leistlist.Eval("self->select(projekt.projektleiter=aktBearb)")
EvalAsString(expression As String) As String
Same as Eval, the result is returned as a string.
Includes(item As Object) As Boolean

Specifies whether an object exists in the list.

Set Projektbearbeiter = Vertec.User
Set Benutzergruppe = Vertec.ArgObject
Set Benutzerlist = Benutzergruppe.Eval("benutzer")

If Benutzerlist.Includes(Projektbearbeiter) Then
    ...
IndexOf(item As Object) As Long

Specifies the position of the specified object in the list.

0-based. If not included: -1.

Set Projektbearbeiter = Vertec.User
Set Benutzergruppe = Vertec.ArgObject
Set Benutzerlist = Benutzergruppe.Eval("benutzer")

i = Benutzerlist.IndexOf(Projektbearbeiter)
Objects(Index As Long) As VtcObjectProxy

Returns an object from the list, specifying an index. 0-based.

Set Projektliste = Projektbearbeiter.Eval("eigProjekte")
For i = 0 To Projektliste.Count - 1
    Set Projekt = Projektliste.Objects(i)
    Projekt.SetMember "code", UCase(Projekt.Member("code"))
Next i
Remove(obj As Object)

Removes an object from the list.

If the list is a link member of a Vertec object, a link is effectively deleted.

It is necessary to check if the object to be removed is really in the list, otherwise the error will appear Item not in List.

Set Projektbearbeiter = Vertec.User
Set Benutzergruppe = Vertec.Argobject
Set Benutzerlist = Benutzergruppe.Eval("benutzer")

If Benutzerlist.Includes(Projektbearbeiter) Then
    Benutzerlist.Remove Projektbearbeiter
End If
RemoveByIndex(Index As Long)

Removes an item from the list based on its index. 0-based.

If the list is a link member of a Vertec object, a link is effectively deleted.

Note that the indices of the remaining objects in the list change. If items are removed due to the indices, we recommend doing so in reverse order.

Set Benutzergruppe = Vertec.ArgObject
Set Benutzerlist = Benutzergruppe.Eval("benutzer")

For i = Benutzerlist.Count - 1 To 0 Step -1
    Benutzerlist.RemoveByIndex (i)
Next i

Other Interfaces

For certain objects such as projects, invoices, etc. are defined their own interfaces, which inherit from VtcObjectProxy. In addition, these interfaces have their own features, which are only available for them, e.g. posting or cancelling invoices.

Interface Methods
ActivityProxy SetPath
TimAuslageProxy MakeOffen, MakeVerrechnet
TimBearbeiterProxy StartTimer, StopTimer
TimLeistungProxy MakeOffen, MakeVerrechnet, UpdateSatz
TimRechnungProxy Buchen, CreateReceipt, ImportPayments, MakeOffen, MakeReceived, ManipulatetoOriginalState, ManipulatetototalAmount, SetTotal, Cancel
TimSpesenProxy MakeOffen, MakeVerrechnet
TimCurrencyProxy GetCourseTo

Netherlands

United Kingdom