Skip to main content

Calculate Life Database Function

Overview​

A database function is provided, as part of the Maximo Aviation installation, which can be used for reporting purposes.

CALCLIFE Function​

This database function is named: CALCLIFE

The function accepts 4 parameters:

ParameterDescription
ASSETIDThe Asset identifier (ASSET.ASSETID).
SITEIDThe Site in which the asset resides (ASSET.SITEID).
METERNAMEThe continuous meter name for which the meter total should be calculated.
ASOFATEThe date for which the the meter total should be calculated.

When the current meter totals for many CM assets are required for a report it is preferrable to use the values persisted in the table: PLUSAASSETTIMESINCE This is because using the CALCLIFE database function has a performance overhead for many repeated calls. See next section for details of this table.

SQL Examples​

Return the current Odometer KM total for the asset with assetnum='TESTASSET1' in Site: BEDFORD

Oracle​

select calclife(asset.assetid, asset.siteid, assetmeter.metername, sysdate) from asset, assetmeter
where asset.assetnum = assetmeter.assetnum
and asset.siteid = assetmeter.siteid
and asset.assetnum = 'TESTASSET001'
and asset.siteid = 'BEDFORD'
and assetmeter.metername='ODOM-KM';

SQL Server​

select calclife(asset.assetid, asset.siteid, assetmeter.metername, GETDATE()) from asset, assetmeter
where asset.assetnum = assetmeter.assetnum
and asset.siteid = assetmeter.siteid
and asset.assetnum = 'TESTASSET001'
and asset.siteid = 'BEDFORD'
and assetmeter.metername='ODOM-KM';

DB2​

select calclife(asset.assetid, asset.siteid, assetmeter.metername, current timestamp) from asset, assetmeter
where asset.assetnum = assetmeter.assetnum
and asset.siteid = assetmeter.siteid
and asset.assetnum = 'TESTASSET001'
and asset.siteid = 'BEDFORD'
and assetmeter.metername='ODOM-KM';