Open EPM ← Back to openepm.dev

Draft a calculation

Draft a readable Python rule using typed primitives and application metadata. A draft does not change business data.

Example source

This disposable example declares an Amount binding, adds exactly 2.50 and writes the result to a complete nine-axis coordinate (eight required dimensions plus Custom01). Confirm the destination is absent before using the empty change ID. With an actual InputAmount binding of 12.50000000, expect 15.00000000 after an authorized run.

from openepm import (
    Amount, ApplicationRule, ApplicationRuleParameter,
    NumericSequence, NumericSequenceExpression,
)

def build(context, parameters):
    input_amount = ApplicationRuleParameter("InputAmount", "Amount", "12.50000000")
    target = {
        "Account": "InputB", "Entity": "PointA", "Year": "Y2027",
        "Period": "P01", "View": "Input", "Value": "Raw",
        "Scenario": "Actual", "DataType": "InputData", "Custom01": "ItemA",
    }
    value = NumericSequenceExpression.parameter(input_amount.reference()) + Amount("2.50")
    sequence = NumericSequence().set(target, value, expected_change_id="")
    return (ApplicationRule("docs.input-uplift", 1)
            .with_parameter(input_amount)
            .then_numeric_sequence(sequence, checkpoint_name="write-input-b"))

The declared sample supports technical validation. Test and Run take the actual rule binding separately; they must not silently substitute the sample. Source-building parameters are {} for this example; rule bindings are {"InputAmount":"12.50000000"}.

Prompt

Read application state and authorized metadata in {{workspace_id}} / {{application_id}}.
Draft {{calculation}} as Python returning an ApplicationRule with stable identities, typed runtime parameters and named units.
Show the proposed source, intended complete coordinates and expected result. Resolve ambiguous names before Save.
When asked to save, use the shared Python source workflow and return every validation diagnostic to the client.

Validate, Test and activate Β· Rule guidelines

Discussion

Discussing Draft a calculation

The discussion service requires JavaScript and a connection to Firebase.