Package Rule Properties and Methods
The following properties and methods enable you to define custom package formulas. All properties and methods are case sensitive. If a number is the result of the formula, then this number is the consumption value. If a string is returned, then there is no consumption value available and a message is returned instead. If a result Consumption(...) is returned, then both a consumption value and a message are returned.
Properties for Custom Package Formulas
The following are properties for Custom Package Formulas.
| Property | Type | Example Value |
|---|---|---|
| SystemID | string | "T7A-001" C |
| lientID | string | "001" |
Methods for Custom Package Formulas
The following table lists methods for custom package formulas.
| Method | Type | Example Condition | Note |
|---|---|---|---|
| HasMetric(int metricID) | bool | HasMetric(1000) | Determines whether a specific metric has a value from any measurement |
| HasMetric(int metricID, int numMonths) | bool | HasMetric(1000, 12) | Determines whether a specific metric has a value that is relevant within the specified period of time |
| HasMetric(int metricID, int numMonths, string periodType) | bool | HasMetric(1100, 12, "C") | Determines whether a specific metric has a value that is relevant within the specified period of time and where the period of the value has the specified type. Allowed period values: Y: The metric is for the last 12 months (relative to the date of measurement). C: The metric is for the last full calendar year. T: The metric is for the current calendar year (year to date). M: The metric is measured monthly and each measurement returns 12 values. Q: The metric is measured quarterly and each measurement returns 4 values. 6: The metric is measured half yearly and each measurement returns 2 values. U: No period is specified, meaning that the metric holds the "current value". |
| Metric(int metricID) | integer | Metric(1000) | Returns the value of the specified metric. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, the value is the sum of all values. When used in a global context (within the TotalConsumption method), the value is the sum of all values across all SAP systems. |
| Metric(int metricID, int numMonths) | integer | Metric(1000, 12) | Returns the value of the specified metric for the specified period of time. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, the value is the sum of all values. When used in a global context (within the TotalConsumption method), the value is the sum of all values across all SAP systems. |
| Metric(int metricID, int numMonths, string periodType) | integer | Metric(1000, 12, "C") | Returns the value of the specified metric for the specified period of time and where the period of the value has the specified type. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, the value is the sum of all values. When used in a global context (within the TotalConsumption method), the value is the sum of all values across all SAP systems. Allowed period values: Y: The metric is for the last 12 months (relative to the date of measurement). C: The metric is for the last full calendar year. T: The metric is for the current calendar year (year to date). M: The metric is measured monthly and each measurement returns 12 values. Q: The metric is measured quarterly and each measurement returns 4 values. 6: The metric is measured half yearly and each measurement returns 2 values. U: No period is specified, meaning that the metric holds the "current value". |
| Metric(int metricID) | IEnumerable <int> | Metrics(1000) Metrics(1000).Max() | Returns a collection of all distinct values for the specified metric. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, multiple values are returned. When used in a global context (within the TotalConsumption method), values for all distinct periods but summed up across all SAP systems are returned. |
| Metrics(int metricID, int numMonths) | IEnumerable <int> | Metrics(1000, 12) | Returns a collection of all distinct values for the specified metric for the specified period of time. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, multiple values are returned. When used in a global context (within the TotalConsumption method), values for all distinct periods but summed up across all SAP systems are returned. |
| Metrics(int metricID, int numMonths, string periodType) | IEnumerable <int> | Metrics(1000, 12, "C") | Returns a collection of all distinct values for the specified metric for the specified period of time and where the period of the value has the specified type. Where a single measurement returns multiple values (distinct periods) for a single metric on a single SAP system, multiple values are returned. When used in a global context (within the TotalConsumption method), values for all distinct periods but summed up across all SAP systems are returned. Allowed period values: Y: The metric is for the last 12 months (relative to the date of measurement). C: The metric is for the last full calendar year. T: The metric is for the current calendar year (year to date). M: The metric is measured monthly and each measurement returns 12 values. Q: The metric is measured quarterly and each measurement returns 4 values. 6: The metric is measured half yearly and each measurement returns 2 values. U: No period is specified, meaning that the metric holds the "current value". |
| Active(bool condition) | string | Active(Metric(1000) > 0) | Returns "Active" if the specified condition is evaluated as true, otherwise returns "Inactive". |
| If(bool condition, int trueResult, int falseResult) | integer | If(Metric(1000) > 0, Metric(1000), 0) | If executes a different formula depending on whether the specified condition is true. |
| If(bool condition, string trueResult, string falseResult) | string | If(Metric(1000) > 0, "Active", "Inactive") | This example is equivalent to "Active(Metric(1000) > 0)" |
| If(bool condition, object trueResult, object falseResult) | object | If(Metric(1000) > 0, Metric(1000), "Inactive") | If executes a different formula depending on whether the specified condition is true. |
| TotalConsumption(object totalConsumed) | n/a | TotalConsumption (Metric(1000)) TotalConsumption (Active(Metric(1000) > 0)) | Runs the formula once for the entire organization, rather than once per system. |
| TotalConsumption(object totalConsumed, object systemConsumed) | n/a | TotalConsumption (Metric(1000), Metric(1000)) | Runs the first formula once for the entire organization, and the second formula once per system. |