By Clay Li on Friday, 01 April 2016
Category: Feature

Query of Asset Item from Assets

Note: "Asset Group" is renamed to "Asset Item" from Calem Release R11d. 

The background:


Data Model

The first step is to modify Calem's asset view "cmv_asset" to include a custom field from the the asset group. The sample views are provided in "Calem_Home/server/setup/view/ CmDbView.custom.sample.conf.php".

create or replace SQL SECURITY INVOKERview cmv_in_zc AS select a.*, b.* from cm_in a left outer join zc_cm_in b on b.zc_id=a.id

$_CALEM_dbview['cmv_asset'] = array(

'generic' => "create or replace SQL SECURITY INVOKERview cmv_asset AS select a.*, b.is_discontinued from cm_asset a left outer join cmv_in_zc b on b.id=a.in_id"

);

create or replace SQL SECURITY INVOKERview cmv_asset AS select a.*, b.is_discontinued from cm_asset a left outer join cmv_in_zc b on b.zc_id=a.id

$_CALEM_table['fields']['is_discontinued']=array('type'=>'boolean');​

Client Customization via Calem Designers

Once the server changes are done you may customize the client forms via Calem Designers to include the new field in the data view and search filter:

The steps above are technical but manageable provided one has basic operational knowledge of MySQL database and have computer skills.