Keys on user entries

Save customer-specific values in keys

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 11.04.2017
Machine translated
Updated: 01.03.2024 | Key-Values renamed to Keys, old version numbers removed.

In order to be able to filter long lists efficiently based on various criteria, customer-specific values can be stored on user entries in so-called keys, which can be queried via OCL.

For this purpose, there is a Keys field on UserEntry (UserEntries are all objects in Vertec that can be stored in folders, such as addresses, projects, users, services, etc.), in which (via Python) the key value pairs are entered. The following data types are supported:

  • String
  • Boolean
  • Date, Datetime
  • Integer
  • Currency

Using Custom Renderer , you can enter keys directly into a field or into the list. An example of this can be found in the section Use cases – setting a key .

Setting a key

The keys are set with the COM method or the Python method setkeyvalue(key, value), e.g.

argobject.setkeyvalue('datum', argobject.eval("creationdatetime.firstOfMonth"))

The above data types are accepted as value. The conversion to the corresponding key type is as follows:

Data typeInputExample
StringString
argobject.setkeyvalue("Mykey", "Mein Text hier")
BooleanTrue, False
argobject.setkeyvalue("Erledigt", True)
DateISO Datestring (“2017-02-03”)
argobject.setkeyvalue('datum', vtcapp.currentdate())
DatetimeISO Datetime (“2017-02-03T08:30”)
argobject.setkeyvalue('datum', vtcapp.currentdatetime())
IntegerInteger number
argobject.setkeyvalue("Anzahl", 5)
CurrencyFloating point number
argobject.setkeyvalue("Betrag", 10573.65)

setkeyvalue() writes numeric types with as few decimal places as possible and no more than 4 decimal places. It is rounded to the 4th decimal place.

NoneEmpty string

argobject.setkeyvalue(“Mykey,” None) or argobject.setkeyvalue(“Mykey,” ““)

The maximum length of all keys (value pairs) set on a user entry is a total of 1000 symbols. If this length is exceeded, an error message will appear.

Query a key

Both Python methods and Ocl operators are available for querying a key. Each query is type-specific.

Python (Disambiguation)

Methodology Result
getkeystring("key")
returns the content of the key as a string
getkeybool("key")
returns False for empty string, “False” (case insensitive) or numeric 0 values, otherwise true
getkeycurr("key")
returns a float or 0 as float
getkeyint("key")
returns an integer or 0 as an integer
getkeydate("key")
returns a date with time part or None
keys
returns a string with all keys set on the object

getkeyint(“key”) and getkeycurr(“key”) return numeric values of the other type (integer vs. float) if no data loss occurs.

OCL

Operator Result
keystring('key')
all -> string, otherwise ““
keybool('key')
",” “False,” “0,” “0.0” -> False, otherwise True
keydate('key')
iso-date (with or without time) -> datetime, otherwise empty
keyint('key')
integer string -> integer, otherwise 0
keycurr('key')
currency string -> currency, otherwise 0.00
keys
returns a string with all keys set on the object

Empty or invalid values result in a default value of the corresponding type. Default values are:

  • String: ““
  • Boolean: ““
  • Date: None (or empty)
  • Integer: 0
  • Currency: 0.00

Deleting a key

A key is deleted by setting the value pair with None or empty string:

setkeyvalue('mykey', None) or setkeyvalue('mykey', '').