OpenSite/Guides/Use the expression editor

From BathAfrica Documentation
Jump to navigation Jump to search
OpenSite 0.0.1 · DevelopmentSource scope and availability


Choose a native formula or a Python expression deliberately.

Stable identifier
opensite.help.use-the-expression-editor

Prerequisites

A practice expression-capable field and a saved checkpoint. Python mode requires the matching Python-enabled host.

Steps

Open the expression affordance

Select the quantity/expression-capable field and use its ... expression button. Read the evaluated value beside the field; the dialog edits the source, not only its formatted display.

Choose the language

Use Formula for the restricted unit-aware expression language. Use Python only for trusted code requiring its Python context. These are different languages: native if(cond, a, b) is not Python syntax.

Preview deliberately

Check destination units and dimensions. Native formula preview can validate the proposed calculation. Python preview is explicit; ordinary field refresh does not silently execute Python. An error is a reason to correct the expression, not ignore it.

Apply and verify

Accept a valid expression and compare its result with an independently known value. The OpenSite/Guides/Native property formulas and OpenSite/Guides/Python property expressions lessons provide checkable examples.

Enable Python only for a trusted document

Loading retains Python source without automatically running it. Use Edit → Enable Python Expressions and then Edit → Recalculate Python Expressions when appropriate. A busy interpreter, exception, cancellation, incompatible result or stale revision can reject evaluation.

Remove an expression intentionally

Use the dialog’s removal/literal workflow when you mean to replace the relationship. Cancelling or accepting an unchanged literal should not be used to erase a stored expression. Recheck the property afterwards.

Expected result

You can tell which language is stored and whether its evaluated value was accepted.

Limitations

Python expressions are trusted code, not a security sandbox. Tables/cell references are not available in this baseline.

Continue learning

User manual · Tutorial pathways · Get help