Display custom icons in application’s list view

Last week, a client asked if it was possible to display a warning icon on asset records based on certain business rules. Initially, this request posed a challenge, but I was able to find a solution to implement it effectively.

The technique is based on a non persistent attribute populated an automation script that evaluates the business rules. The piece of the trick is to add the non persistent attribute in an icon control in the list view of the Assets application. Lets see all the steps.

Non-persistent attribute

Open Database Configuration application, open the ASSET object and create the following attribute.

  • Attribute: CX_STATUSICON
  • Title: Status
  • Type: ALN
  • Length: 50
  • Persistent: No

Apply database configuration changes.

Automation script

Now we can use an automation script on the Init event of the ASSET object to populate the non-persistent attribute with the name of the icon to be displayed.

Create the following script with Object launch point:

  • Launch Point: CX_ASSETINIT – Initialize ASSET
  • Object: ASSET
  • Event: Initialize Value
  • Language: python
  • Script
status = mbo.getString("STATUS")
if status=="INACTIVE":
  mbo.setValue("CX_STATUSICON", "st_MessageCritical.png")
elif status=="BROKEN":
  mbo.setValue("CX_STATUSICON", "st_MessageWarning.png")

Application

Open Application Designer application, export the ASSET application XML file and modify it adding the lines in bold at the beginning to of the main table definition.

<table beanclass="psdi.webclient.beans.asset.AssetResultsBean" ...
  <tablebody displayrowsperpage="20" ...    
    <tablecol dataattribute="CX_STATUSICON" filterable="false" id="cx_STATUSICON">
      <image id="cx_STATUSICONimg"/>
    </tablecol>

Display custom icons in application’s list view

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top