Additional fields

How to configure additional fields

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 30.01.2004
Updated: 12.09.2024 | Note on navigation button for control element Pathbox (Path) added.

The list of existing fields in Vertec is specified by the model and cannot be changed. However, additional fields are available if you want to add additional information to data (e.g. order probability on project).

Defining additional fields

Additional fields are managed under Settings > Customizing > Additional fields. Each additional field is based on an additional field class. To create an additional field, click on additional field in the New menu or right-click on the folder.

Name

You can access the additional field via this name. See the section Accessing additional fields below. The name must not contain umlauts or start with a number, otherwise the authorization system may fail.

Due to a change in version 6.5.0.21, it is no longer permitted to use names for additional fields that match a built-in Python method. This concerns the following expressions:

  • istypeof
  • eval
  • evalocl
  • delete
  • unload
  • setmemberoutofdate
  • setmlvalue
  • getmlvalue
  • checkright
  • linkto
  • unlink
  • getmemfootprint
  • subscribetomember

Additional fields that have such a name are shown as invalid and must be resolved to ensure operation.

Description

Here you can specify the description under which the additional field should appear on the interface. If you do not indicate anything here, the name is shown on the interface. The description is a MLString field, i.e. it is language specific.

Field type, selection type, expression

 

Additional fields can contain standardized values with relevant selection options and input controls. In addition to the field type, you can specify a selection type and an optional expression.

The following table describes the available field types with matching selection types (& expressions).

Field type   Selection type   Expression
String
Normal string with a maximum length of 255 characters.
Path
Displays a file system folder selection dialog and saves the path to the selected folder. /
   
File
Displays a file system file selection dialog and saves the path to the selected file. /
True, False
Boolean value. Displayed as a checkbox.
 
   
Integer number
Integer value (integer).
 
   
Minutes
Minute value. Formatting according to System setting Display Minutes .
 
   
Fixed-point number
Number with decimal places.
 
   
Date
Displays a selection dialog (date picker).
 
   
Image
Image files, e.g. gif, jpeg, bitmap can be loaded into the additional field via right mouse button.
Image
Displays the Windows folder browser; the image is saved in the field. /
Object
 
 
Assigns a Vertec object via drag & drop or by means of a suitable selection type.
Object
Selection dialog for selecting an object in Vertec. The list of objects in the selection dialog is calculated using the expression.

The objects associated with the base class are available.

Example: An additional field with the name main project , the class project user and the expression eigProjekte displays a list of all the user’s owned projects.

Address
Displays an address search dialog and assigns the selected address. /
Folder
Displays a tree dialog with Vertec folders and assigns the selected folder. The expression specifies the content type of the folder to be displayed.
Selection
Allows you to select from a predefined list. Values are specified as expressions separated by commas.
None
Intended for simple list selections. As an expression, the list is defined by hand according to the following pattern: "Möglichkeit 1", "Möglichkeit 2", "Variante 3" .
Text
Text data of any length (longer than 256). Is shown in memo field.

 

   
(ANSI text)
Should no longer be used, as Unicode texts cannot be saved.

 

   
Order

Here you can specify the order in which the additional fields should appear on the interface.

Classes

Specifies where and for which data type the additional field should appear. Select the appropriate type from the dialog by clicking on the three dots.

Visibility

Additional fields that are used internally for calculations can be hidden on the interface.

Condition

Visibility can be controlled by an OCL expression. The result of this OCL expression must be a True/False (Boolean). If the result is true, the additional field is shown.

The additional fields appear in the individual view of the relevant entries on the Further information page:

In addition, you can place them in a different location via customizing.

Translation of selection type additional fields

Starting with Vertec 6.5.0.15, the strings in selection type additional fields are translated if the additional field definition (AdditionalFieldClass) has an entry ID.

  • For a selection type additional field in a list:
    • Expression: zusatzfeldint(<name>)
    • Control: cmbZusatzfeld
    • Renderer: rndZusatzfeld
    the selection options are translated if the additional field definition has set an entry ID.
  • The translated text also appears in unselected rows in the list.
  • If a translated selection type additional field is used as the first field of an additional field class, then the string representation of an additional field class instance points to the translated value. The additional field class instance does not need to have an entry ID (the entry ID on the additional field class definition is sufficient).
  • All three of the following variants can be used in the code to configure??? the selection type additional field:
    • Configuring??? the selection index (integer value)
    • Configuring the translated text in the selected language
    • Configuring the untranslated text (native language)

If you have defined selection type additional fields and want to translate them, define an entry ID on the relevant additional field definition. You can find out how to do this in the article Languages/Terms ??? in the section Translations from version 6.4.0.9 .

Access to additional fields

You can also view and show additional field items in lists, use them in scripts and reports, or filter them in an Expression folder by accessing them via OCL. Querying via SQL folder is also possible.

It is important to note that the additional field items on already existing Vertec objects are not created until they are accessed accordingly. Before they are not present in the database, which is Access via SQL but essential.

When are additional fields created?

Creating new objects

When a new object is created, all associated additional field classes are created.

New additional field class is created on an existing object

For already existing objects, the additional field classes are created in the following operations:

  • When displayed in a Detail window .
  • Per Scripting the field is created when it is described: projekt.jahr = 2022 (Example: integer add-on field jahr on project). It can also simply according to initialized shall be: projekt.jahr = 0
  • Per Scripting the field is also created when it is read, but only via OCL. This means: the read access via Python (e.g. myyear = projekt.jahr ) does not create the field, but read access via OCL does: myyear = projekt.evalocl("zusatzfeldint('jahr')")
  • Via List settings when the “writing” field is accessed in a column. It doesn’t have to be really writing, but it has to be so that Vertec feels that it could be written: zusatzfeldasstring(...) for example, does not work, since this is a read-only access; zusatzfeldint(...) on the other hand, creates the field, because this expression can also be used to write. (Note: This restriction only applies to list settings. For read access via OCL in scripts, as described in point 3, this does not apply, there the field is also created for read-only access)

The reason for the somewhat complex behavior of variants 3 and 4 is the optimization, which returns the default value for a non-existent additional field item, since a write access should only be prevented due to a display, but no error message should appear.

The field is only accessible via SQL (e.g. via SQL folder) after it has been created. Therefore, the custom field items on classes of which objects already exist should always be created directly.

Creating additional fields for existing objects

After creating an additional field, you can Run script , which creates the field on all existing objects, such as:

projects = vtcapp.evalocl(“project”)
for project in projects:
    project year = 0

vtcapp.updatedatabase()

How the different additional field types are initialized can be found in the section Python below.

OCL

The various additional field classes can be accessed via OCL as follows:

  • add-on fieldAsString(name): returns the value of an add-on field, regardless of its type, as a string value.
    • Depending on the type, the field is queried as follows:
      Additional field type Operator Default return value (if nothing has been explicitly set yet)
      String custom field item Empty string
      True, False additional fieldbool Wrong
      Integer number additional fieldint 0
      Minutes additional fieldint 0
      Fixed-point number additional fieldcurr 0.00
      Date additional field date NULL
      Image additional field blob NULL
      Object additional fieldobj (see tips below) NULL
      Selection additionalfieldint (returns the position of the selection)
      additionalfieldasstring (returns the selection text)
      0
      First value of the list
      Text zusatzfeld Empty string
      ANSI Text (Legacy) additional field blob NULL

      Example: All addresses marked as ABC addresses (True,False Additional field “ABC address” on address):

      address entry->select(additional fieldbool('ABC address’))

Python

Access to additional field classes in Python is simple via the additional field name, e.g. projekt.jahr .

Read-only access ( myyear = projekt.jahr ) does not create the field (see section When are custom field items created above), on the other hand, the write access already exists ( projekt.jahr = 2022 ). If you want to create the field without setting a value, it can be initialized as follows:

Additional field type Initialization
String = "" (empty string)
True, False = 0 (False)
Integer number = 0
Minutes = 0
Fixed-point number = 0
Date = None
ANSI Text = None
Image = None
Object = None
Selection = 0
Text = None

 

SQL

The different additional field classes can be accessed via SQL as follows:

Additional field type Expression SQL (database field) Where expression

String

Value Value like “Aha%”

True, False

ValueBoolean

ValueBoolean=1 (true)
ValueBoolean=0 (false)

Integer number

ValueInteger ValueInteger >= 1000

Minutes

ValueInteger ValueInteger >= 1000

Fixed-point number

ValueCurrency ValueCurrency = 1350

Date

ValueDate ValueDate = “Mar 15, 2017”

ANSI Text

ValueBlob ValueBlob containing 'Newsletter’ (Firebird)
ValueBlob like “%Newsletter%” (MS SQL)

Image

ValueBlob ValueBlob <> ““ (for: there is an image assigned)

Object

ValueObject

ValueObject in (SELECT bold_id from Table where value like “%AHA%”)

Selection

ValueInteger

ValueInteger=0 (same order as selection on the interface: 0=first entry, 1=second entry, ...)

Text ValueText WertText like "%Newsletter%"

For a detailed description and examples, see SQL expressions for SQL folders.

XML (customizing)

Additional field classes can also be placed in lists and pages via customizing. The following matrix applies to the selection of the control:

Field type Selection type Control element Example
String Address AddressReferenceBox
<AddressReferenceBox Label=”Address” 
    ValueExpression=”additional fieldobj('character address’)” />
String File PathBox
<PathBox Label=”File” 
    ValueExpression=”additional field('File’)” SelectType=”FileOpen” />

In order to be able to open the file directly, a navigation button must be inserted:

<PathBox Label=”File” 
    ValueExpression=”additional field('File’)” ShowNavLinkButton=”True” SelectType=”FileOpen” />
String Path PathBox
<PathBox Label=”Path” 
    ValueExpression=”additional field('path’)” SelectType=”Folder” />

To be able to open the path directly, an additional Navigation button shall be inserted.

<PathBox Label=”Path”
    ValueExpression=”additional field('path’)” ShowNavLinkButton=”True” SelectType=”Folder” />
String   Textbox
<TextBox Label=”Zeichen” ValueExpression=”zusatzfeld('Zeichen’)” />
True, False   Checkbox
<CheckBox Label=”True, False” 
    ValueExpression=”additional fieldbool('TrueFalse’)” />
Integer number   Textbox
<TextBox Label=”Integer” 
    ValueExpression=”additional fieldint('integer’)” />
Minutes   Textbox
<TextBox Label=”Minutes” ValueExpression=”additionalfieldint('Minutes’)” 
    Converter=”Minutes” />
Fixed-point number   Textbox
<TextBox Label=”Fixed point number” 
    ValueExpression=”additional fieldcurr('fixed point number’)” />
Date   DatePicker
<DatePicker Label=”Date” 
    ValueExpression=”additional fielddate('Date’)” />
ANSI Text   TextArea
<TextArea Label=”Text” 
    ValueExpression=”additional fieldblob('Text’)” Lines=”4” />
Image   Image
<Image Label=”Image” 
    ValueExpression=”additional fieldblob('image’)” Height=”150” />
Object Address AddressReferenceBox
<AddressReferenceBox Label=”Address” 
    ValueExpression=”additionalfieldobj('ObjectAddress’)” />
Object Vertec folder TreeReferenceBox
<TreeReferenceBox Label=”Folder” 
    ValueExpression=”additionalfieldobj('Objectfolder’)” 
    BrowseClass=”Container” SelectFilter=”AbstractFolder” />
Object   AdditionalFieldComboBox
<AdditionalFieldComboBox Label=”Object” 
    ValueExpression=”additionalfieldobj('Object’)” />
Selection   AdditionalFieldComboBox
<AdditionalFieldComboBox Label=”Selection” 
    ValueExpression=”additional fieldint('selection’)” />
Text   TextArea
<TextArea Label=”Text” ValueExpression=”zusatzfeld('Text’)” Lines=”4” />

Difference between type-dependent and type-independent query

In most cases, this results in the same result on the interface, because in the end it is usually a string.

The main difference is with selection extension fields. These are implemented internally as integer custom field items. This means that the expression extensionint(name) returns a number. If the text of the selection is to be shown, the expression extensionasstring(name) should be used.

Similarly, the type-specific OCL operators return NULL values if the custom field item is NULL, but this is not a problem in most cases, since NULL values are rendered as empty strings. If a NULL value causes problems, this can be avoided by using the extension fieldAsString.

Tips for handling additional fieldobj

The extensionObj operator for querying object extension fields may result in errors when applied to a list of objects in an OCL expression. The error message is:

TBoldObjectList.AddElement: Element not a TBoldObject

Example: Object add-on field 'Branch’ on project user. Point to an address, for example.

openservices.processor.additional fieldobj('branch’)->asset->size

should indicate the quantity of different branches in a list of services. But gives the above error.

Solution

openservices.processor->collect(additional fieldObj('branch’)->oclasType(UserEntry))->asset->size

Explanation

Applying additionalfieldObj to a list is equivalent to an implicit “collect” operation, which fails because additionalfieldObj does not return the linked object directly, but the linked field.

Converting the type to a compatible object type (the actual type of the object or User Entry) solves the problem. For the type conversion to take place, the collect operation to be explicitly formulated.

Bitte wählen Sie Ihren Standort