Previous Topic: Create Business Logic ModulesNext Topic: Implement Dynamic Targets


Create Parameters

Parameters provide business users a quick and intuitive way with which to view and change their values using the graphical user interface (GUI) without having to edit the formula script.

The use of parameters within the Business Logic enables the creation of general formulas that can have a wide use across the system and optimizes the use of the modules.

Parameters can be defined at Contract or Metric level. Metric level parameters are displayed and configured in the Objective statement tab of the Metric details. The Business Logic has access only to the Metric level parameters; therefore in order to access a Contract parameter from within a Metric, a different type of Parameter is created locally within the Metric. It is called a dynamic Parameter and it takes its value as a reference from the Contract level parameters. The reference values allowed in the dynamic parameter are only those defined in the parent contract of the Metric.

Parameters types:

In order to access the parameter's values from the formula code, it is necessary to use the Parameters object and refer to the parameter name.

Example:

Parameters("Threshold")
(Note this is a short-hand method of calling the value - normally this is done as Parameters.Item("Threshold") )

Or, for a table type parameter:

Parameters("Table")("Word")("Price")

(where the "Word" and "Price" values are the row and column names of the tabled parameter, respectively)

Table parameters should only be used following a number of key points:

  1. Define a global variable (e.g. dim myTableParam)
  2. In the function OnLoad, fill the variable from the parameters object (e.g. “Set myTableParam = Parameters(“MyParametersTable”))
  3. Thereafter use only the created object, myTableParam. The parameter itself should not be used outside the OnLoad function, and you should only refer to the global variable object you created from it.
    (e.g. “dim myVal: myVal = myTableParam (“myRow”)(“myColumn”)).

This frees memory that the parameter takes up and prevents the Engine from creating the parameter's map on each parameter call and for each "OnXXXEvent", which can be called thousands of times per Metric

The following code illustrates the correct usage of a table parameter:

Option Explicit

Dim sum
Dim myParamTable

Sub OnLoad(TIME)
   Set myParamTable = Parameters("MyTableParam")
End Sub

Sub OnRegistration(dispatcher)
  dispatcher.RegisterByResource" OnEvent", "EventType", "ResourceType"
End Sub

Sub OnPeriodStart(TIME)
   sum = 0
End Sub

Sub OnEvent(eventDetails)
   If Context.IsWithinTimeslot Then
      sum = sum + 1 * myParTimeSlotamTable("firstRow")("secondColumn")
   End If
End Sub

Function Result
   Result = ( sum * myParamTable("secondRow")("thirdColumn")  )
End Function

The following methods are available for each parameter object created within the code.

Parameter

Description

IsExist

Does param exist. Does not work on contract parameters.

IsNumeric

Is param of type Number.

IsText

Is param of type text.

IsDate

Is param of type Date.

IsTable

Is param of type Table.

IsEntryExist

Does an entry in Table exist.

IsEntryNumeric

Is entry in Table of type Numeric.

IsEntryText

Is entry in Table of type Text.

IsEntryDate

Is entry in table of type Date.

Dump

Returns a list of all parameters.

Item

Refers to the parameter value.