Binding variables

#1

Let’s suppose I have a simple metric with variable myVariable:

{
  "id": "MySimpleMetric_MySourceType",
  "name": "MySimpleMetric",
  "srcType": "MySourceType",
  "path": "path",
  "expression": "expression(myVariable)",
  "variables": [{
    "name": "myVariable",
    "dataType": "string"
  }]
}

And I use this simple metric in a compound metric:

{
  "id": "MyCompoundMetric",
  "name": "MyCompoundMetric",
  "expression": "2 * MySimpleMetric",
  "variables": [{
    "name": "myVariable",
    "dataType": "string"
  }]
}

Do I need to specify variables on the compound metric? If not will I still see that myVariable is expected if I fetch MyCompoundMetric?

1 Like

Evaluate metric in a variable interval
#2

You should provide the variable “myVariable” on the compound metric if you plan to provide a value for it at design time. If you do not have a value for it at design time, then you can provide the value for it at runtime.

If you don’t then an exception will be thrown saying that we are expecting a value for the variable “myVariable”.

0 Likes