Editable Fields: Autovalues¶
Autovalues fill an attribute field automatically on the server when saving; the user does not have to enter the value. They are configured on the edit field. These fields are usually defined as read-only or invisible in the input form.
Selection in the CMS¶
Most autovalues are selected from a list in the CMS field Auto Value. For free syntax, choose custom and enter the actual value under Custom Auto Value.
This applies in particular to:
Expressions and templates with a leading
=URL and role parameters
Spatial queries with
frommask-insert-default::...The older, still supported values
create_user,change_user,create_date_yyyy.mm.ddanddatetime
For db_select and db_select_on_insert, the autovalue itself is selected in the list.
The connection string and SQL statement are entered in the two additional custom autovalue fields.
In the following example, the length of the created line geometry is written into a field:
When is an autovalue evaluated?¶
An autovalue can apply depending on the edit operation:
Group |
Insert |
Update |
Delete |
Mass attribution |
Transfer |
|---|---|---|---|---|---|
|
yes |
no |
no |
no |
no |
|
yes |
yes |
yes |
yes |
yes |
|
yes |
no |
no |
no |
no |
|
yes |
no |
no |
no |
no |
|
no |
yes |
no |
no |
no |
Geometry, context and general autovalues |
yes |
yes |
yes |
yes |
yes |
|
yes |
yes |
yes |
yes |
yes |
Expressions with |
yes |
yes |
yes |
yes |
yes |
Note
The table describes the evaluation of the autovalue. Whether a field is actually processed for a given operation additionally depends on the respective editing workflow.
Values on insert only¶
These autovalues are set only when a new feature is created.
User and login¶
Autovalue |
Description |
Example |
|---|---|---|
|
Database user of the editing workspace connection |
|
|
Login of the current user without the WebGIS namespace before |
|
|
Full login as stored on the current user |
|
|
Login without WebGIS namespace and without Windows domain |
|
|
Domain from |
|
Example for the full login oidc::DOMAIN\max:
create_login→DOMAIN\maxcreate_login_full→oidc::DOMAIN\maxcreate_login_short→maxcreate_login_domain→oidc::DOMAIN
For the notation name@domain, only the part after @ is returned, in lower case. For
DOMAIN\name, the part before \ is returned. A WebGIS namespace before :: is not removed
for *_login_domain; therefore the example above yields oidc::DOMAIN.
GUIDs¶
Autovalue |
Description |
Format |
|---|---|---|
|
Random UUID |
32 hex characters without separators |
|
Random UUID |
with hyphens and curly braces |
|
Time-sortable UUID version 7 |
32 hex characters without separators |
|
Time-sortable UUID version 7 |
with hyphens and curly braces |
guid → 9f9c67bea32147e8a46100c17acef040
guid_sql → {9f9c67be-a321-47e8-a461-00c17acef040}
guidis suitable if the GUID should be stored as text in the database,guid_sqlif it should be stored as a GUID in an SQL database.Version 7 GUIDs are suitable for storage in databases when the underlying fields should also be indexed. The generated GUIDs are sorted chronologically by their value, which generally leads to less fragmentation of the indexes.
Creation date and time¶
Autovalue |
Description |
Format |
|---|---|---|
|
Local creation date |
culture-dependent short date format |
|
Local creation date |
|
|
Local creation time |
culture-dependent short time format |
|
Local date and time |
short date format + space + short time format |
|
Local date and time |
|
|
UTC timestamp |
|
For storage across systems, create_datetime_utc is preferable, e.g.
2026-10-01T15:23:45.127Z.
Change values¶
change_* is evaluated not only on update, but on every edit operation in which the field is
processed. The same field can therefore be set on insert and updated on every subsequent change.
User and login¶
Autovalue |
Description |
|---|---|
|
Database user of the editing workspace connection |
|
Current login without the WebGIS namespace before |
|
Full login of the current user |
|
Login without WebGIS namespace and without Windows domain |
|
Domain from |
Change date and time¶
Autovalue |
Description |
Format |
|---|---|---|
|
Local change date |
culture-dependent short date format |
|
Local change time |
culture-dependent short time format |
|
Local date and time |
short date format + space + short time format |
|
Local date and time |
|
|
UTC timestamp |
|
For audit fields, change_datetime_utc is preferable.
URL and role parameters¶
URL parameters¶
url-parameter:<name>
Takes the value of a parameter from the original URL (see section: Calling the Viewer), e.g.
url-parameter:project_id. If the parameter does not exist, an empty string is set.
Evaluation can be restricted to insert or update. For any other operation, the field is not set:
oninsert:url-parameter:project_id
onupdate:url-parameter:project_id
Role parameters¶
role-parameter:<name>
Takes a parameter from the role information of the current user, e.g.
role-parameter:GEMEINDENUMMER (see Role Parameters). If the role parameter
does not exist, an empty string is set. Role parameters can also be restricted:
oninsert:role-parameter:GEMEINDENUMMER
onupdate:role-parameter:GEMEINDENUMMER
Geometry autovalues¶
Geometry autovalues use the coordinate system of the feature geometry by default. For coordinates, lengths and areas, a positive target SRefId (EPSG code) can be specified after a colon:
shape_area:31256
shape_centroid_x:4326
The calculation is performed on a transformed copy. The original feature geometry and its
SrsId are not modified. If a target SRefId is specified, the source geometry must have a valid
SrsId. An invalid EPSG/SRefId value results in a configuration error.
Tip
The EPSG code should always be specified. Otherwise the result depends on the coordinate system of the feature geometry, usually that of the target feature class, which is not guaranteed.
Lengths and areas¶
Autovalue |
Geometry |
Result |
|---|---|---|
|
Polyline |
Length, rounded to 2 decimal places |
|
Polyline |
Length, rounded to an integer |
|
Polygon |
Area, rounded to 2 decimal places |
|
Polygon |
Area, rounded to an integer |
|
Polygon |
Perimeter, rounded to 2 decimal places |
The unit results from the coordinate system used. With a metric projected coordinate system, lengths are typically meters and areas square meters.
Centroid and extent¶
Autovalue |
Result |
|---|---|
|
X coordinate of the centroid |
|
Y coordinate of the centroid |
|
minimum X coordinate of the bounding box |
|
minimum Y coordinate of the bounding box |
|
maximum X coordinate of the bounding box |
|
maximum Y coordinate of the bounding box |
The centroid is determined depending on the geometry type:
Point: the point itself
Multipoint: mean of all points
Polyline: point at half the line length
Polygon: area-weighted centroid; holes are subtracted
Envelope: center point
Structure and metadata¶
Autovalue |
Result |
|---|---|
|
Number of vertices |
|
Number of geometry parts |
|
|
|
SRefId of the feature geometry |
These four autovalues do not accept a target SRefId, because they do not depend on a coordinate transformation.
If there is no geometry or the geometry type does not fit the calculation, this autovalue sets no value.
General values and edit context¶
Autovalue |
Description |
|---|---|
|
Local date and time in the format |
|
Current map scale, rounded to an integer |
|
Current edit operation |
|
SRefId of the current map |
|
Service ID of the edited topic |
|
Layer ID of the edited topic |
|
ID of the editing theme |
edit_operation returns a stable technical value:
Operation |
Value |
|---|---|
Insert |
|
Update |
|
Delete |
|
Mass attribution |
|
Transfer |
|
Custom values with “custom”¶
With the autovalue custom, values can be defined directly in the field Custom Auto Value.
A value with a leading = is evaluated as an expression or template. For example, a field
SOURCE can always have the value WEBGIS entered:
=WEBGIS
Expressions and templates¶
If a custom autovalue starts with =, it is treated as an expression or legacy template:
=Object [NAME]
=concat([FIRSTNAME], " ", [LASTNAME])
=round(shape_area(31256), 2)
Expressions are evaluated on all edit operations. Field values are read from the feature currently being edited. The complete syntax, all functions and the security rules are described in the appendix: Expressions.
Default value in the insert mask only¶
mask-insert-default::<value>
This entry is not an autovalue set on the server. When a new feature is created, it merely shows
a default value in the input mask, e.g. mask-insert-default::Draft. The user can change the
value before saving.
Automatic Attribution via Spatial Relationships¶
A custom autovalue can take values from features of another layer that spatially intersect the current geometry.
<field> from <layer> [options]
The layer can be specified by its name or its ID. Available options:
Option |
Description |
Default |
|---|---|---|
|
Service in which the layer is searched |
empty |
|
Buffer around the current geometry |
|
|
Maximum number of values taken |
|
|
Separator between multiple values |
|
Note
For compatibility reasons, seperator must be written exactly in this spelling.
The special value space in the separator is replaced by a space. Texts containing spaces can be
written in quotation marks. For point layers, a buffer distance of at least 0.03 is used. The
unit of the buffer corresponds to the coordinate system of the feature geometry. The values found
are joined in query order; null values are skipped.
Examples:
NR from GDBAbfrage service kataster
→ The attribute NR is taken from objects in the GDBAbfrage topic if they spatially overlap with the saved object. If there are multiple matches, they are separated by semicolons.
GNR from Grundstuecke service kataster max 10 seperator ", "
→ The attribute GNR is taken; at most 10 values are entered, separated by comma and space.
TYP from kasten service strom@mycms bufferdist 20 seperator space-space max 10
→ The attribute TYP is taken from objects in the Kasten topic if they are within 20 units. Multiple results are separated with space-hyphen-space, a maximum of 10 results.
Automatic Values from a Database Query (“db_select”)¶
db_select executes a scalar database query on every supported edit operation. The following
information must be provided:
Custom Auto Value: connection string
Custom Auto Value 2: SQL statement
Example:
select GNR
from GRUNDSTUECK
where OBJECTID = {{OBJECTID}}
Feature fields are referenced with {{FIELDNAME}} (e.g. {{VORGANG_TEXT}}). These values are
passed as database parameters and are not inserted directly into the SQL.
Warning
No quotes may be placed around placeholders, not even for text fields:
-- correct
where CODE = {{CODE}}
-- wrong
where CODE = '{{CODE}}'
User- and session-dependent filter placeholders are also resolved before execution. The statement must return exactly one scalar value. The first value of the first record is used as the autovalue.
db_select_on_insert¶
Works like db_select, but is executed on insert only. For other operations, the field is not set
and the database configuration is not checked.
Behavior for mass attribution¶
For a mass attribution, the query is executed only if at least one of the referenced feature fields is present. If only some but not all required fields are present, an error listing the missing attribute names is raised.
Autovalues via Web Service (DataLinq)¶
If Custom Auto Value is an HTTP or HTTPS URL, no direct database connection is opened; instead a web service (e.g. DataLinq) is queried:
Custom Auto Value: DataLinq/HTTP URL
Custom Auto Value 2: query string with
{{FIELDNAME}}
An example of a DataLinq query:
https://localhost:44341/datalinq/select/auswahllisten(oJ...token)@color?value=4711
This query returns the following JSON result:
[
{
"value": "4711",
"name": "Blau"
}
]
To integrate this service, the fields must be filled in as follows:
ConnectionString:
https://localhost:44341/datalinq/select/auswahllisten(oJ...token)@color
SqlStatement:
value={{color}}
Here, color is the edit input/selection-list field used for this autovalue. In this example, the
value “Blau” would be adopted as the autovalue. The field values are passed URL-encoded.
Note
The first result of the query is always used. The response must be a JSON array.
For a URL query, the value is taken from the field “name”.
For DataLinq PlainText endpoints, the field is always called “text” by definition.
If a custom SQL query is used in DataLinq, the desired field should be renamed:
SELECT FARBE as name FROM TABLE WHERE ...
Note
Security note:
Connection strings or URLs with tokens should not be stored directly in the CMS.
Instead, these values should be stored in the
secretssection.The connection string can then be specified with a placeholder:
{{select-datalinq-endpoint-auswahllisten}}@color
Error and empty-value behavior¶
An unknown autovalue does not set the field.
An empty autovalue does not set the field.
An operation-bound autovalue (
create_*,oninsert:,onupdate:…) sets no value on a different operation.Missing URL or role parameters set an empty string.
Missing or unsuitable geometries cause the respective geometry autovalue to set no value.
Invalid SRefIds, missing source SRefIds for a transformation, unknown services/layers and faulty database configurations produce a comprehensible error.
Expressions report syntax, type and calculation errors and do not silently fall back to another parser.
Recommended configurations¶
Field → autovalue |
Purpose |
|---|---|
|
Creator |
|
Creation time |
|
Last editor |
|
Change time |
|
Unique, sortable ID |
|
Area in a metric coordinate system |
|
Log the edit context |
|
Log the edit context |
|
Log the edit context |