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
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:
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 .
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 type | Input | Example |
---|---|---|
String | String | argobject.setkeyvalue("Mykey", "Mein Text hier") |
Boolean | True, False | argobject.setkeyvalue("Erledigt", True) |
Date | ISO Datestring (“2017-02-03”) | argobject.setkeyvalue('datum', vtcapp.currentdate()) |
Datetime | ISO Datetime (“2017-02-03T08:30”) | argobject.setkeyvalue('datum', vtcapp.currentdatetime()) |
Integer | Integer number | argobject.setkeyvalue("Anzahl", 5) |
Currency | Floating 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. |
None | Empty 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.
Both Python methods and Ocl operators are available for querying a key. Each query is type-specific.
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.
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:
A key is deleted by setting the value pair with None or empty string:
setkeyvalue('mykey', None)
or setkeyvalue('mykey', '')
.