Language: Deutsch · English
Compute attribute values at runtime via a database function – incl. SQL examples and status traffic lights.
HOW-TO APPLICATION DEVELOPER UPDATED: JUL 2026 APPLIES TO NUCLOS 4.2026.X
On this page
Instead of storing a fixed value, a calculated attribute derives its content from a function at database level. The value is recomputed at runtime and displayed – without having to save the record. Typical cases: an article's annual revenue, computed date values, status traffic lights.
Calculated attributes behave almost like normal attributes (shown in layouts and result lists) but are not stored in the database. Their value therefore cannot be set by a rule; reference fields cannot be calculated.
Performance
Use sparingly: the calculation can be very time-consuming – especially in searches and result lists.
Sorting
Sorting of calculated attributes in the result list is disabled by default and can be enabled via the SORT_CALCULATED_ATTRIBUTES parameter.
CA_ (calculated attribute).Computes stock − reserved. The parameter id is the INTID of the current object; the return value is varchar2 (attribute values are stored as strings).
CREATE OR REPLACE FUNCTION CA_ARTIKELVERFUEGBAR(id IN number) RETURN varchar2 IS
summe number(12);
bestand number(12);
reserviert number(12);
begin
SELECT strvalue INTO bestand
FROM t_ud_go_attribute
WHERE intid_t_md_attribute = (SELECT intid FROM t_md_attribute WHERE strattribute='artikelBestand')
AND intid_t_ud_genericobject = id;
SELECT strvalue INTO reserviert
FROM t_ud_go_attribute
WHERE intid_t_md_attribute = (SELECT intid FROM t_md_attribute WHERE strattribute='artikelReserviert')
AND intid_t_ud_genericobject = id;
summe:=bestand-reserviert;
RETURN(summe);
end CA_ARTIKELVERFUEGBAR;
A calculated attribute can also return an image – ideal for status traffic lights. The images are uploaded beforehand as resources (Configuration → Other → Resources).
Traffic light as a calculated attribute.
CREATE OR REPLACE FUNCTION C31G_CA_PROJEKT_VERFUEGBARKEIT(id numeric)
RETURNS bytea AS
$BODY$
DECLARE
ist numeric(9,2);
soll numeric(9,2);
bild bytea;
BEGIN
select dblfortschritt, dblusedbudget / dblworkingbudget * 100 into ist, soll from c31g_projekt where intid=id;
if (ist = 100) then
bild := null;
else
if (ist >= soll) then
select blbcontent into bild from t_md_resource where strname = 'Ampel grün';
else
select blbcontent into bild from t_md_resource where strname = 'Ampel rot';
end if;
end if;
RETURN bild;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
In the BO wizard the calculated attribute is linked in step 7 (attribute definitions).
Linking in the BO wizard.