KPI widgets

KPI widgets are configured in the type kpiWidget or one of its subitems. They use the jquery-kpiwidget library.

The following figure shows a KPI widget:

You can provide settings both in the widget script and in the widget settings. The values set in the script overwrite the values entered in the widget settings.

Available attributes: 

Coding example

KPI widgets are based on the jquery-kpiwidget library. The script has to return a HashMap containing the attributes which define the KPI representation.

The following code provides an example of a KPI widget script:

import com.consol.cmas.common.model.ticket.*

import java.util.*

import com.consol.cmas.common.model.DateRange

TicketCriteria crt = new TicketCriteria()

def to_date = new Date()

def from_date = to_date - 7

def range = new DateRange(from_date,to_date)

crt.setCreationDateRange(range)

// crt.setStatus(TicketCriteria.Status.OPEN)

ticketcount = ticketService.getByCriteria(crt).size()

switch (ticketcount) {

case 0..25:

trendline = 'down'

break

case 26..50:

trendline = 'flat'

break

default:

trendline = 'up'

}

return[value: ticketcount as String, trend: trendline, visible: 'true']

Code example 38: Script for a KPI widget which counts the cases which have been opened during the last week