Calculation custom field on Listview

Hi all,

Currently, I want to custom the listview to show the KPI. For example:

KPI for Sales order

Purpose

  • Staff can see the fulfillment time of order (such as 3-4 days not finish order), so they can prioritize to right order.

*Issues
I make a custom script to set value for customer field KPITime based on status: If order status not delivery: Now() - Sales order date, If finish: delivery time - sales order date

The issue is this field is not automatically calculation on listview, everytime load listview, this will be calculate again, How can I hook into listview load event and calculate this field?