Field types

Virtual field

Field type virtual. A field whose value is computed from other fields every time it is displayed. It has no data field and stores nothing. What the people entering data see is described under Virtual field . The management page under Data model › Virtual fields is described under Virtual fields , the procedure under Create a virtual field .

Combination modes

ModeSourcesResult
directoneThe value as it is. Optionally split into several values at a separator
concatseveralJoined with a separator string; by default empty sources are left out
fallbackseveralThe first value that is not empty
unionseveralAll values of all sources, each only once, joined with separator. With split each source is split first
jsone or moreResult of a checked formula
JSON
{
  "mode": "concat",
  "separator": ", ",
  "skip_empty": true,
  "sources": ["Kuenstler_Vorname", "Kuenstler_Zuname"]
}

The mode fallback, using the example “Anzeigetitel” (display title) from the demo collection:

Example Result
JSON
{
  "mode": "fallback",
  "sources": ["Objekttitel", "Alternativtitel", "Inventarnummer"]
}
Tile of the virtual field Anzeigetitel (display title) with the computed value Jar with Lion-Head Handles, without an input box
The object has an Objekttitel (object title), so the first source wins. Without it, the Alternativtitel (alternative title) would come next, then the Inventarnummer (inventory number).

The mode union takes the sources in their order, splits each one if split is set, and leaves out empty values and repetitions. What is compared is the displayed value without spaces at the edges. Case counts: “Paris” and “paris” both remain. If you want to even them out, use js.

JSON
{
  "mode": "union",
  "separator": ", ",
  "split": ";",
  "sources": ["Herstellungsort", "Fundort"]
}

If Herstellungsort (place of manufacture) holds “Rom; Paris” and Fundort (find spot) holds “Paris”, the result is Rom, Paris.

Besides fields, you can also choose project data as sources (name, English name, location, start, end, status) and the object ID.

The formula in mode js

The source values are available under werte['Feldname']. In addition there are the helpers leer, spalte, verbinde, tab, cfg, meta and fmt, as well as String, Number, Boolean, Math, Intl, Object, Array, JSON, Date and the number converters.

Example Result
JS
const a = werte['Datierung von'];
const b = werte['Datierung bis'];
if (leer(a) && leer(b)) return '';
if (leer(b) || String(a) === String(b)) return String(a);
if (leer(a)) return String(b);
return String(a) + '–' + String(b);
Tile of the virtual field Datierungsspanne (date range) with the computed value 1300-1368
Date range: Datierung von (dated from) 1300 and Datierung bis (dated to) 1368 become 1300-1368. If both years are the same or one is missing, only one year is shown.
Example Result
JS
const teile = [];
for (const n of ['Höhe', 'Breite', 'Tiefe']) {
  const v = werte[n];
  if (leer(v)) continue;
  teile.push(String(Number(v)).replace('.', ','));
}
return teile.length > 0 ? teile.join(' × ') + ' cm' : '';
Tile of the virtual field Objektmaße (object dimensions) with the computed value 39,4 × 37,5 cm
Object dimensions: height, width and depth with a decimal comma and unit on one line. The object has no depth, so the empty dimension is left out.
JS
// Display title: working title, otherwise original title, otherwise the German title from a JSON field
return werte['Arbeitstitel'] || werte['Originaltitel'] || tab(werte['Titel'], 'de') || '';
JS
// Call up the finished formatter of a JSON field, otherwise the raw value
return fmt('Maße') || werte['Maße'];

The formula runs in a checked sandbox, the same one as for output formatters and field conditions. Every formula that is allowed is guaranteed to finish:

AllowedNot allowed
const, let, var, if, try/catchfunctions of your own, except arrow functions as the argument of a list method
Loops for … of and for … infor (;;), while
.push and other changes to lists you created yourselfChanges to the data that was read
Methods from the approved list (map, filter, join, split …)Calls to other functions and methods

The code editor reports anything rejected together with the allowed alternative. “Copy prompt for an AI” puts together the rules, the available names and the structure of the data for a language model. If the formula fails the check, the definition is not saved; a saved formula that later becomes inadmissible is not run.

Label as a template

If the field’s label contains the placeholder for the value (value in double curly braces, shown as a block in the editor), the whole tile is built from the label, with the value at that point. This gives tiles such as Inventory: 12/345, location storage with formatting. Without the placeholder the label sits above the value.

Permissions

A virtual field is exactly as visible as its weakest source. If someone may not read one of the sources, the field disappears for them completely. There is no access setting of its own and no second source of permissions; otherwise a virtual field would be a way around the field permissions. The management page shows when source fields cannot be resolved; such a field is not displayed anywhere.

Filtering, sorting, searching

You can filter, sort and group by a virtual field, also as the column field in the kanban, and the full-text search finds its value. For this, Moliri computes the values per field and project in advance in the background, the first time they are used, and keeps them up to date from then on. How values are compared is set by Sort as in the definition, see Virtual fields .

The values computed in advance are the same for all accounts. That is why only those who may read all sources can filter and sort by them. If a field reads from links to objects, files or events, a person’s own value could be narrower than the one computed in advance; such fields are available in filters and sorting only to accounts with status 4 or higher.

Working with the sources

TaskWhere
Changing the value, annotations, historyOn the source fields; the virtual field has no stored value
Loading timeEvery source is loaded too, even if only the virtual field is displayed. A field over five sources loads five fields

Virtual field or output formatter

Both produce prepared values with the same helpers. An output formatter belongs to one field and formats only that field. A virtual field reads several fields and is a field of its own with its own tile. To make a JSON field readable, use the formatter; to calculate across fields, use the virtual field. See Formatting .