Skip to main content
Version: OpCon 26.0 (On-Prem)

Property Expressions API

The Property Expressions API evaluates expressions that read OpCon property values, perform operations on those values, and return a result. You use these expressions to build dynamic dependency conditions, trigger events based on runtime data, and set property values programmatically.

For the complete syntax reference — including all operators, functions, and operand types — see Property Expressions API Syntax.

How property expressions work

An expression combines OpCon property tokens, literal values, operators, and functions into a single statement. When OpCon evaluates the expression, it resolves each token to its current property value and computes the result.

All property values are stored as strings. Use the conversion functions (ToInt(), ToLong(), ToFloat()) to treat a property value as a number before performing arithmetic or comparison operations.

Expressions can evaluate to one of three types:

  • Boolean — used in dependency conditions and complex expression triggers; the dependency resolves when the result is true
  • Numeric — used in arithmetic, comparisons, and property-value calculations
  • String — used in string comparisons, concatenation, and property assignments

Where you can use property expressions

You can use property expressions in the following places within OpCon:

LocationPurpose[[= ]] wrapper required
Expression Dependency tabResolve a job dependency based on the evaluated resultNo
Job Completion Complex Expression triggerFire an event based on runtime data after a job completesNo
Command lineEmbed an evaluated result in a job's command argumentsYes
Event stringEmbed an evaluated result in an OpCon event parameterYes
$PROPERTY:SET eventCompute and store a new property valueYes

When an expression appears on a command line or in an event string, wrap the entire expression in [[= ]] so OpCon evaluates it before passing the value to the command or event. This wrapper is not required in expression dependencies or job completion complex expression triggers.

Common use cases

The following scenarios illustrate how property expressions solve real automation problems. Full syntax for each example is in Property Expressions API Syntax — Use cases.

Depend on a property string value

A job can wait until a Global Property matches a specific string. For example, a job that must only run when a property named Today equals the current OpCon date uses the following expression dependency:

[[Today]]==[[$DATE]]

When the result is true, OpCon resolves the dependency. When the result is false, the job remains in Wait Expression Dependency status.

Depend on a property numeric value

A job can wait until a Global Property equals a specific integer. Because all properties are stored as strings, use ToInt() to convert the value before comparing:

ToInt([[BackupServer]])==1

Depend on a machine running no jobs

Before running maintenance on a machine, you can confirm the machine is idle:

ToInt([[MI.$MACHINE RUNNING JOBS.MachineName]]) == 0

Trigger events based on run time deviation

The TimeDiff() function computes the difference between two times and returns the result in a format you choose. You can compare that difference against the estimated run time to fire events when a job runs shorter or longer than expected.

See Trigger events when a job runs short or long for full expression examples.

Set a property value with an expression

Use the $PROPERTY:SET event with an expression to compute a new property value from existing properties:

$PROPERTY:SET,Target,[[=(ToInt([[Source1]])-ToInt([[Source2]]))/8]]

REST API

OpCon exposes a REST API endpoint that evaluates a property expression and returns the result without saving it to the database. Use this endpoint to test expressions during development or to retrieve computed values from an external system.

Endpoint: POST /api/propertyExpression

Request body:

FieldTypeRequiredDescription
expressionstringYesThe property expression to evaluate

Response body:

FieldTypeDescription
expressionstringThe expression that was submitted
resultstringThe evaluated result
statusstringSuccess or Failed
messagestringEvaluated on success; the exception message on failure

On success, the API returns 200 OK. If the expression field is null or missing, the API returns 400 Bad Request.