COM Interfaces

Description of COM Interfaces

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 26.06.2003
Machine translated
Updated: 13.07.2023 | SetResourcePlanValue does not work with planning editors

An interface in the sense of COM describes the properties and features that a COM object provides.

Depending on whether the desktop app (local COM server) or the cloud app (proxy for the connection to the COM server) is addressed via COM, the interfaces have different names. However, the use is the same, the calling application does not have to make a distinction.

The interface names listed below are according to the scheme COM-Name / Proxy-Name.

All examples are written in Visual Basic.

Ivtcsession / comcoclass

This is the default interface of the Vertec COM server. CreateObject("Vertec.App") returns a session reference. Other objects can be requested from IVtcSession/ComCoClass.

Dim Vertec As Object
Set Vertec = CreateObject("Vertec.App")
Feature / Function description
ArgObject

Returns the up-to-date object (up-to-date 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 up-to-date 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 /SUPER parameter and the administrator is logged in. Otherwise, the call will fail.
CreateList(classname as string)

Creates a new empty 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 applied via COM if Vertec has been started with the /SUPER parameter and the administrator is logged in. Otherwise, the call will fail.
Eval(expression as string)

This feature evaluates any OCL expression. The result is returned as a variant and can be interpreted as String, Integer, Float, Boolean, or Object, depending on the OCL expression.

Caution: Eval with an OCL expression will load all the objects from the database necessary to calculate it. In some cases, this can cause performance problems or high memory consumption. GetWithSQL is preferable for querying larger quantities of the same objects.

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

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

For example, services should be shown from a certain point in time. Instead of searching the services in the manner “openServices->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"

be indicated.

ExecuteFileReport
(templatepath As String,
rootObj As IVtcObject,
[optarg As IVtcObject],
[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 while running the desktop app. It allows you to call up a Legacy Office Report .

  • templatepath: Path to the template.
  • rootObj: The Vertec object for which the report should be executed.
  • optarg: Corresponds to the optional address on the print dialog. Optional argument. If not used, specify parameters with nothing.
  • filename: Location path of the newly created document. Optional. Can be specified as absolute path or as filename (relative, uses rootObj’s doc path 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 on the print dialog. Optional.
  • text: Corresponds to the comment on the print dialog. Optional.
  • linkToRoot: Links the document to the main object (checkmark Auf Hauptobjekt on the print dialog). Optional. Default: No. Linking can only be done when the report is printed (see filename parameter).
  • linkToOptarg: Links the document to its address (checkmark Auf Adresse on the print dialog). Optional. Default: No. Linking can only be done 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

be called up.

GetObjectByID(ID: String or int)

Returns the 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 an SQL query on a specific Vertec class. This means that SQL selects all objects of a specific class according to the specified criteria (SQL Select, Where Clause) and returns them in a list.

The executing user must have administrator privileges or SQL Query privileges.

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 do not want the input box to have a title, specify an empty string.
  • Prompt: The text to be shown
  • Default: The text that should be shown as the default response in the field. If you want the input field to be shown blank, specify a blank string here.
Wert = Vertec.InputBox("Vertec", "Wie lautet Ihr Name?", "")

Return values:

  • If the user OK click (or Enter press), the contents of the text box are returned.
  • If the user Abbrechen an empty string is returned. Therefore, it is not possible to distinguish whether the user has not entered anything or canceled.
MsgBox (Prompt as String, [Buttons as int], [Title as String]): integer

Displays a message box.

  • Prompt: The message you want to show.
  • 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: blank. Message box title.
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 a Vertec script to be invoked. The executing user must have administrative privileges or the right to execute this script.

  • scripttext: The code is passed as script text. 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 here an object is simply passed, without evaluation of an expression.

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

Allows you to set resource plan values via script.

  • user: Project user on which resources are scheduled. Does not work with Planning Editors .
  • project: If the is set to project: The project to which the plan is being planned. Otherwise: Nothing.
  • phase: If the Planning Level is set to phase: The project phase to which it is planned. Otherwise: Nothing.
  • date: The period in which the date is located is taken.
  • intervalTyp: Disregarded from Vertec 6.6, because the planning interval is fixed and 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 invoke the details window of the Vertec object passed as argument.

Note that this changes the ArgObject, i.e. the up-to-date object in Vertec.

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

Translates a text to the date 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. These objects are no longer invalid as long as they do not violate any rules.

User

Returns the up-to-date logged-in user.

 

Ivtcobject / vtcobjectproxy

This is the default interface for all Vertec objects.

For certain objects such as projects, invoices etc. own interfaces are defined, which inherit from IVtcObject/VtcObjectProxy, i.e. the properties and features of IVtcObject/VtcObjectProxy are also present on the object interfaces.

Feature / Function 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 object’s default representation 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

-> Project users

DefaultInterface

Returns this for objects with special interfaces, otherwise IVtcObject/VtcObjectProxy.

No longer needed, because the objects themselves are supplied as an interface, so that you can work with them directly.

Delete

Deletes the object in Vertec. Returns an error if the logged-in user is not authorized 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 (IVtcSession/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 the String representation of the result is returned directly.

Dim Projektbearbeiter as Object
Dim Wert as String

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

If the object contains , they can be queried with this method in the other languages.

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

The query via Member (Taetigkeit.Member("text")) always returns the value in the up-to-date interface language.

The MLStrings are set via SetMLValue.

HasTag(tag As String) As Boolean

Query 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 can be seen in the example, the entire tree is taken into account, 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 with the specified role.

  • target: The object to which the up-to-date object should be linked
  • role: The desired role can be specified in two ways:
    • The designation of the link roller on the corresponding link type.
    • The Id entry 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 released again.

For detailed information, see Operators and Methods for Links.

Member(membername: string)

Read access to the member with the specified name. This can be either an attribute or 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 IVtcObjectList/VtcObjectListProxy

Allows for persistent Multilink Members to load only a selection of the linked objects using SQL Filter.

The executing user must have administrator privileges or SQL Query privileges.

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 one day 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 is done via OCL :

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

Removing 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 particular member “out of date,” so that the next time the database is accessed again and so the current value is in it.

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

The method can also be used on derived attributes and thus a new calculation can be triggered without anything having changed (as is usually 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 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 with the corresponding name as a string. Cannot be used for object add-ons.

For field types <> Zeichen or Text the string must be passed according to the field type (numbers “0” or “0.00,” Boolean “0” or “1” etc.) or setadditionalfieldAsVariant must be used.

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"

Custom fields are queried via custom field(name) or custom fieldAsVariant(name).

Setadditional fieldAsVariant(Name As String, Value)

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

For 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

Custom fields are queried via custom field(name) or custom fieldAsVariant(name).

Unlink(target: IVtcObject; role: string)

Removes a shortcut 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 delete sharing is configured, the link cannot be resolved using this method. The resolution of such a link is only possible by deleting one of the link partner objects.

LinkTo can be used to create links.

For detailed information, see Operators and Methods for Links.

UnloadObject

Removes the object from the Vertec object store. Use with caution, as subsequent access to the unloaded object may result in errors.

Custom field(additional field name as string)

Read access to the custom field. Returns the value as a string regardless of type (corresponds to the OCL query additional fieldasstring ).

If a custom 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 items are written with SetAdditionalfield or SetAdditionalfieldAsVariant.

Additional fieldAsVariant
(additional fieldname as string)

Read access to the custom field. Returns the value depending on the type.    

If a custom 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 supplied.

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 items are written with SetAdditionalfield or SetAdditionalfieldAsVariant.

 

Ivtcobjectlist / vtcobjectlistproxy

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

Feature / Function description
Add(obj As IVtcObject/VtcObjectProxy)

Adds an object to 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 IVtcObjectList/VtcObjectListProxy)

Adds the submitted list to the up-date 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
Like Eval, the result is returned as a string.
Includes(item As IVtcObject/VtcObjectProxy) 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 IVtcObject/VtcObjectProxy) 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 Object

Returns an object from the list with 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 IVtcObject)

Removes an object from the list.

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

It must be checked 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 indexes of the remaining objects in the list change. If items are removed because of the indexes, 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. own interfaces are defined, which inherit from IVtcObject/VtcObjectProxy. In addition, these interfaces have their own features, which are only available on them, e.g. posting or cancelling invoices.

Interfaces Methods
Activity / ActivityProxy SetPath
ITimDelivery / TimDeliveryProxy MakeOffen, MakeBilled
ITimEditor / TimEditorProxy StartTimer, StopTimer
ITimPerformance / TimPerformanceProxy MakeOffen, MakeBilled, UpdateSatz
ITimInvoice / TimInvoiceProxy Post, CreateBeleg, ImportPayments, MakeOpen, MakeCreated, ManipulateToOriginalState, ManipulateToTotalAmount, SetTotal, Cancel
ITimExpenses / TimExpensesProxy MakeOffen, MakeBilled
ITimCurrency / TimCurrencyProxy GetCourseTo

 

Vertec Type Library

For viewing the object catalog, code completion and compile-time type checking, the Vertec Type Library can be integrated into the external application. Here in the example we use Microsoft Excel for viewing.

First, we reference the Vertec Type Library. This is done in the Visual Basic Editor via the menu Tools > References. The following window opens:

In the available references we activate the Vertec Typelibrary.

Now we have access to the object catalog:

Object Catalogue

Using the View > Object Catalog menu or the function key F2 the object catalog opens.

In the Combobox <Alle Bibliotheken> we select Vertec off. The following view appears:

If a class is marked on the left (in this example the IVtcObject), the corresponding methods (as symbol the green cubes) and properties (as symbol the hand) are displayed on the right.

It is important that the objects are not directly linked to types such as e.g. IVtcObject, App etc. The declaration of objects, object lists, session etc. always takes place on Object. So not:

Dim Projektbearbeiter as IVtcObject

But:

Dim Projektbearbeiter as Object

The corresponding interfaces are available during operation as soon as the object is loaded.