Skip to main content
Version: 11.2

$.udb(ds).lifeTime()

note

This article is about the lifeTime() function of the DataSourceContainer object.

$.udb(ds).lifeTime()

Gets the value of the Life Time property of the first data source in the container.

Returns an integer.

Syntax

$.udb( *ds* ).lifeTime()

The required ds is a data source selector.

The value of the lifeTime property determines the lifecycle of the data in the data source:

ValueExplanation
-1Data stays unchanged until it leaves the scope.
0Data is refreshed each time the data source is touched.
n (where n > 0)Data is refreshed when an interval of n seconds has passed after the time it was last read.

Example

// interpret EMP's lifeTime setting
let lifeTime = $.udb('EMP').lifeTime();

if (lifeTime === -1) {
console.log('EMP stays unchanged until it leaves scope');
}
else if (lifeTime === 0) {
console.log('EMP is refreshed every time it is touched');
}
else {
console.log('EMP is refreshed after being unused for %d seconds', lifeTime);
}