How to Insert a Metric

This article explains how to insert a Metric into a kosmos/BOS server. 
See the steps below. 

1. Open the application.
2. Go to menu "System/Metric Definitions" and activate

metric b 40

Form that shows all the Metric definitions

3. Click on button "Append" and the form for the new Metric shows. This is a multipage one.

metric e1 50

This page shows the basic elements for the metric


metric e2 50

In this page we put the script for the periodic Metric calculation


metric e3 50

In this page we set the owner role of the Metric and the viewers (as roles) for the Metric

In first page we put "Title", "Unit Meassure", "Update Period", "Decimal Points", "Starting Date" of the metric. There is a possibility that the Metric is to be provided manualy by users. In this case we check the "Manual Insert".

In this first page there is the possibility to define a composite Metric. A composite Metric is one that consists from the weighted participation of other Metrics of lower level. This way is possible to construct Balanced Scorecards of various depth. The Metrics that can participate to a composite Metric are always targeted ones.

In the second page we provide the script that calculates the periodic value of Metric. An example scipt is the following:

fun calculate ( date0, date1, date2, val0 )

    {  date0  = starting metric date}    
    {> date1  = starting calculation period date}    
    {<= date2 = ending calculation period date}    
    {val0     = previus period value}

     start_sql "*" "KOSMOS"
              WHERE (DATE > :D1) AND (DATE <= :D2)    
     q = QueryByName()
     call TSetParam(q,"D1",date1)
     call TSetParam(q,"D2",date2)                                                                                                      
     call TExecute(q)
     val = TGetFld(q,"SVALUE")      
     count   = TRecordCount(q)
     if (count = 0) then        
        is_null = 1     
        result = val         
        is_null = 0      
     call FreeEmbSQL(q)


The required variables in the script is "result" and "is_null".

In the third page we provide the role that is "owner" for the Metric. So if the period of Metric is "1 Month" then every month an A
ctivity will issued to the user's terminal for the inspection of the Metric value. Viewers of the Metric also can be defined in this page. Every viewer of the Metric cas see it in the "KPIs" section of his/her User Interface.