MISSING
MISSING
is a special value that represents the absence of a value. For example, if the responsible field
of a KPI is empty, calling first()
on the responsible property would return a value of MISSING
.
Methods
Extended has a couple of special methods for dealing with MISSING
values.
isMissing
isMissing()
is a method that can be chained onto a token expression, and will return true if a value
is missing for the expression. It is a shorter equivalent to doing .... = MISSING
.
Syntax |
Return Value |
|
True if a value is missing, otherwise false |
Examples
myKpi := t.KPI005 // A KPI with no user in the Responsible property
myKpi.responsible.first().isMissing() // True
myKpi.responsible.first() = MISSING // True
whenMissing
whenMissing()
is a method that can be chained onto a token expression for handling missing values
and avoiding some of the ugly warnings they can cause. whenMissing()
takes a parameter, and if
the expression that it is chained to returns a missing value, the missing value will be replaced by
the parameter.
Syntax |
Return Value |
|
Returns arg1 if value is missing, otherwise the value of the expression |
Examples
myKpi := t.KPI005 // A KPI with no user in the Responsible property
myKpi.responsible.first().isMissing() // True
myKpi.responsible.first() // Causes a warning related to missing value
myKpi.responsible.first().whenMissing("No Responsible set") // No Responsible set