{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":51610,"path":"telecom-service-ops/telecommunications-service-operations-management/nokia-mpn-formula-engine.md","title":"MPN Formula Engine processing","bundle":null,"doc_type":null,"release":"australia","body":"\n# MPN Formula Engine processing\n\nThe Formula Engine processes raw KPI formulas and stores the result in the **Formatted KPI Formula** field when a record is inserted or updated in the MPN Formulas \\[sn\\_tsom\\_em\\_conns\\_kpi\\_definitions\\] table.\n\nWhen a record is inserted or updated in the MPN Formulas table, a business rule named Transform KPI Formula to Script fires automatically. It invokes the `NokiaMpnFormulaEngineSEP` extension point to process the raw formula before it is stored in the **Formatted KPI Formula** field.\n\nThe processing runs in two steps:\n\n1.  Cleanup: The raw value in **KPI Formula** is normalized into a JavaScript-evaluable expression:\n    -   Whitespace and line breaks are collapsed to a single space.\n    -   `Sum()` wrappers are removed; `Max()` and `Min()` are converted to `Math.max()` and `Math.min()`.\n    -   `**` exponentiation notation is converted to `Math.pow()` for compatibility with the MID Server JavaScript engine.\n2.  Validation — The processed formula is checked for balanced parentheses. If the parentheses are unbalanced, the raw value is still stored but a warning is logged. Records with unbalanced parentheses are skipped during metric collection at runtime.\n\nThe resulting value is written to the **Formatted KPI Formula** field and is the expression that the metric calculation engine references at runtime.\n\n**Note:** If no `NokiaMpnFormulaEngineSEP` implementation is registered, the raw value in the **KPI Formula** value is stored unchanged and a warning is logged.\n\n**Related topics**  \n\n\n[MPN Formulas table](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/telecom-service-ops/telecommunications-service-operations-management/nokia-mpn-formulas-table.md)\n\n"}}