SMA Evaluate Expression
Theme: Configure
Who Is It For? System Administrator, Automation Engineer
What Is It?
SMA Evaluate Expression (SMAEvalExp.exe) accesses the OpCon Property Expressions API — the same API used by Job Dependencies and Events Based on Complex Expressions. See Property Expressions API Syntax for details. This utility is maintained primarily for backward compatibility and can be scheduled from an OpCon Windows job or run from a Windows command prompt (cmd.exe).
SMAEvalExp.exe is installed in the <Target Directory>\OpConxps\MSLSAM\ directory and connects to the OpCon database using the .dat file generated by the SMA Connection Configuration utility. See SMA Connection Configuration Tool for details.
Configuring the Database Connection Information
To configure the Database Connection Information, complete the following steps:
Open SMAConnectionConfig.exe from
<Target Directory>\OpConxps\MSLSAM\(e.g.,C:\Program Files\OpConxps\MSLSAM\)In the SMAConnectionConfig window, enter the server name (include the instance name if needed, using
<Server>\<Instance Name>syntax) in the Server Instance Name fieldEnter the database name in the Database Name field
Configure authentication using one of these methods:
- Select the Use Windows Authentication option
- Enter
opconsamin the Database Login ID field and the password in the Database Password field
Select a Configuration option:
- None: No setting (default)
- SQL Always On: SQL Server configured for high availability
- SQL Mirroring: SQL Server configured for mirroring
Select Connect
Select OK to confirm the connection, then OK to close
Syntax
SMAEvalExp.exe "expression"
Parameters
- SMAEvalExp.exe: The executable in
<Target Directory>\OpConxps\MSLSAM\. - Expression: A logic, numeric, or property-assignment expression
- Enclose the full expression in double quotes (required for Windows command-line)
- If the expression contains embedded tokens, wrap it in the
[[=]]syntax. See Property Expressions API Syntax for details
Examples
The following examples use Operators, Functions, and System Properties to demonstrate common automation uses:
- Check a Property Value for a Specific String
- Check a Property Value for a Specific Number (Integer)
- Trigger Events Based the Exit Code of a Job
- Trigger Events Based on Specific Exit Codes
- Trigger Events Based on Deviation from Estimated Run Time
- Set the Value of a Property with an Expression
- Set the Value of a Property Based on the Contents of Other Properties and/or Constants
Check a Property Value for a Specific String
Use the == operator to verify whether a global property equals a specific string.
The following checks whether the global property "DDIService" equals "running":
SMAEvalExp.exe "[[=[[DDIService]]=="running"]]"
The command succeeds if true and fails if false. When run as an OpCon job, events can be configured based on failure.
Check a Property Value for a Specific Number (Integer)
Use the ToInt function and the == operator to verify whether a global property equals a specific integer.
The following checks whether the global property "BackupServer" equals 1:
SMAEvalExp.exe "[[=ToInt([[BackupServer]])==1]]"
The command succeeds if true and fails if false. When run as an OpCon job, events can be configured based on failure.
Trigger Events Based the Exit Code of a Job
Use the ToIntNE function (with a default of 0) and the < operator to check a job's exit code.
The following checks whether the DNSEntries job termination value is less than 20, defaulting to "True" if no termination value exists:
SMAEvalExp.exe "[[=ToIntNE([[JI.$JOB TERMINATION.2013/10/29.BPMNetworkTest.DNSEntries]],0)<20]]"
The command succeeds if true and fails if false. When run as an OpCon job, events can be configured based on failure.
Trigger Events Based on Specific Exit Codes
Scenario: If Windows JobA fails with exit code 0000000033, run FixFiles to repair the environment, then rerun JobA.
Solution: Create a job named EvalJobAExit on the same schedule as JobA.
- Configure EvalJobAExit to succeed unless exit code 0000000033 is returned
- Configure a
$JOB:ADDevent on EvalJobAExit failure to add the FixFiles job to the schedule
Trigger Events Based on Deviation from Estimated Run Time
Use SMAEvalExp.exe to evaluate whether a job's actual run time deviates from its estimated run time. Common scenarios:
- Job runs less than the estimated run time minus the deviation percent
- Job runs longer than the estimated run time plus the deviation percent:
- Wait for the monitored job to finish, then run SMAEvalExp to check
- Trigger the event as soon as the monitored job exceeds the acceptable threshold
Trigger Events Based on a Job Running for Less Time than Expected
Assume the job is named JobA and the requirement is to detect if it runs for less than 5 minutes. Create an SMAEvalExp job as a subsequent job to JobA on the same schedule, then run:
SMAEvalExp.exe "[[=TimeDiff([[JI.$ACTUAL RUN TIME.[[$DATE]].[[$SCHEDULE NAME]].JobA]], \"00:00:00\",\"signed_secs\") >= 5 * 60]]"
- Returns exit code 0 if JobA ran 5 minutes or more (result is true)
- Returns exit code -1 if JobA ran less than 5 minutes (result is false)
- When the SMAEvalExp job fails, events can be configured based on failure
Trigger Events after Job Completion if a Job's Run Time Exceeds the Estimated Run Time by a User-defined Percentage
Use SMAEvalExp.exe to check the time difference between a job's actual and estimated run time.
Assume the job is named JobA and the deviation threshold is 10%. Create an SMAEvalExp job as a subsequent job to JobA on the same schedule, then run the expression to compare actual versus estimated time:
- If the calculated percent is 10 or less, the job succeeds (result is true)
- If the calculated percent exceeds 10, the command fails (result is false)
- When the SMAEvalExp job fails, events can be configured based on failure
Set the Value of a Property with an Expression
Use the ToInt function and the = (assignment) operator to set a property value using a calculated expression.
The following sets the global property "Available" based on an arithmetic expression that includes the Machine Instance property "DiskSpace":
SMAEvalExp.exe "[[=[[Available]]=(25/4 + 84.56 - ToInt([[MI.DiskSpace.MachName]]))]]"
The command succeeds if true and fails if false. When run as an OpCon job, events can be configured based on failure.
Set the Value of a Property Based on the Contents of Other Properties and/or Constants
Use the ToInt function and the = operator to set a property value based on other properties.
The following sets the User Property "Target" using two other User Defined Properties and a constant:
SMAEvalExp.exe "[[=[[Target]] =(ToInt([[Source1]])-ToInt([[Source2]]))/8]]"
If "Source1" is 85 and "Source2" is 21, SMAEvalExp.exe returns exit code 0 and sets "Target" to 8 (i.e., (85-21)/8 = 8).
Logging
SMAEvalExp writes logging to the standard Job Output. Continuous recommends configuring the Windows LSAM to capture job output to use the View Job Output feature from the Enterprise Manager. See Job Output Retrieval and Viewing Job Output for details.
Exit Codes
| Exit Code | Description |
|---|---|
| 0 | Expression evaluation succeeded. The result is included in the Job Output. |
| -1 | Expression evaluation failed. The error detail is included in the Job Output. |
Configuration Options
| Setting | What It Does | Default | Notes |
|---|---|---|---|
| SMAEvalExp.exe | The executable in \OpConxps\MSLSAM\ | — | — |
| Expression | A logic, numeric, or property-assignment expression | — | — |
| Scenario | If Windows JobA fails with exit code 0000000033, run FixFiles to repair the environment, then rerun JobA | — | — |
| Solution | Create a job named EvalJobAExit on the same schedule as JobA | — | — |
FAQs
Q: What API does SMAEvalExp.exe use, and what can it evaluate?
SMAEvalExp.exe accesses the same OpCon Property Expressions API used by Job Dependencies and Events Based on Complex Expressions. It can evaluate logic, numeric, and property-assignment expressions.
Q: How does SMAEvalExp.exe connect to the OpCon database?
It connects using the .dat file generated by the SMA Connection Configuration utility (SMAConnectionConfig.exe), located in the <Target Directory>\OpConxps\MSLSAM\ directory.
Q: When are double quotes required in the SMAEvalExp.exe command line?
The full expression must always be enclosed in double quotes for the Windows command line. If the expression contains embedded tokens, wrap it in the [[=]] syntax as well.
Glossary
SMA Connection Configuration: A utility that generates the database connection file (.dat) used by OpCon server programs and utilities to connect to the OpCon SQL Server database.
LSAM (Local Schedule Activity Monitor): An agent installed on a target platform that runs jobs in the native language of that platform and communicates results back to SAM via SMANetCom over TCP/IP.
Enterprise Manager (EM): OpCon's rich client graphical user interface for Windows and Linux, used to define schedules and jobs, manage automation data, and perform operational tasks.
Threshold: A numeric variable stored in the OpCon database used to control job execution. Jobs can be made dependent on threshold values, and OpCon events can update threshold values at runtime.
Token (Global Property): A named value stored in the OpCon database, referenced in job definitions and events using [[PropertyName]] syntax. Tokens pass dynamic values — such as dates, file paths, or counts — into automation workflows.
OpConxps: The standard installation directory name for OpCon program files, configuration files, and output data on Windows machines.
Machine: A platform defined in the OpCon database that has an LSAM installed. OpCon routes job execution requests to machines via SMANetCom, and machines report job completion status back to SAM.
Schedule: A named container for jobs in OpCon, built for a specific date to create that day's automation. Schedules define build settings, frequencies, and the jobs that run within them.