You must have administrator rights to access this feature.
You must have a Cartegraph OMS advanced feature extension to access this feature.
In Scenario Builder, the cost to complete an activity is calculated for every activity included in a Scenario. The formula to calculate the Activity Cost is defined on the Trigger for that activity in the Protocol associated to the Scenario. A Scenario's Inflation Rate also affects the Activity Cost. To learn about how Inflation Rate is applied to Activity Cost, see Scenario Inflation Rate.
The cost of an activity in a trigger can be represented by a number or an expression that can evaluate to a number. The cost expression is validated when the user saves the Trigger. If the expression is invalid, a message displays and the record cannot be saved in that state. Check the Error Log for more details on what the issue with the expression is specifically.
When a scenario runs, if the cost cannot be calculated for a particular activity, the Activity Cost for that activity is null which is displayed as $0.00.
It is also possible for the Activity Cost to be calculated to $0. If the cost expression is referencing a field on the asset, such as length multiplied by a unit cost, and the length is blank. A blank field is treated as zero so the Activity Cost is zero.
Syntax Examples for Cost:
A flat cost:
A unit cost multiplied by an asset field with number and unit:
20.00 * [Length.Amount]
A unit cost multiplied by an asset field through a lookup:
50.00 * [CurrentInspectionID\NumberofPotholes]
Two combined calculations utilizing asset attribute fields:
(34.50 * [Length.Amount]) + (30.00 * [NumberofLanes])
Calculation Including IF/THEN statement:
If (([PavementClassification] is equal to "Brick and Block")) Then 10000.00 Else 5000.00 End_If
General Tips for Cost Expressions
- Never use any currency symbol like $
- To use a field value, use the ID of the field surrounded by brackets. For example, Number of Lanes = [NumberofLanes]. ID can be found in properties of the field in structure manager.
- When using quantities use ".Amount" to access the number portion and ".Unit" to access the unit portion. For example, Length = 5 ft; Length.Amount = 5, Length.Unit = "ft"
- To access a field from the most recent inspection, use the lookup field "Current Inspection ID"
- Fields that are through a lookup can be accessed using [Lookup field ID\Field ID], for example the sign MUTCD Code field Shape: [MUTCDCode\Shape]
- If a field is referenced in an expression and its value is null then a zero is used in its place
- The expression is validated on save of the trigger. If the expression is invalid you will not be able to save the changes to the trigger record. The error log will contain the detailed error message.
- If a field is invalid during the run of a scenario (for example the field no longer exists in the recordset) the cost for the activity will be set to null and the cost per impact will be null. The activity will still be used in the Scenario where appropriate.
- When building a conditional cost expression, use the syntax view of the advanced filter dialog to get the correct syntax.
- If you are having problems getting your conditional statement to work even after you gathered the condition from the filter dialog and the field ID from structure manager, try putting parenthesis around the whole expression. For example, (IF([PavementClassification] = "Concrete") THEN 903.18 ELSE [Length.Amount] END_IF)
- If you want to round your cost to a certain amount of decimal places, you can use the ROUND function. Example: ROUND([Length.Amount], 1) will set your cost to Length rounded to 1 decimal place. The first component is the number or expression you wish to use and the second component is the number of decimals you wish to round to.
- The following items are not supported:
- Unit conversion is not supported. Any quantity field values used in the expression should be in consistent units to ensure consistent expected results.
- Using a quantity field as a whole is not supported. When using a quantity field use the pieces of a quantity field: .Amount and .Unit If you need to do an expression like if "length = 20 ft then cost is $50 otherwise the cost is $30" then use the expression: If (([Length.amount] = 20)) AND (([Length.unit] is equal to "ft")) Then 50.00 Else 30.00 End_If
- Count expressions are not supported. For example the cost expression: Number of times pot holes have been filed on this asset * $75 would process to the expression: (Count(([cgTasks\Activity] is equal to "Pothole filled") * 75.00, however using this expression will not be appropriately processed. A trigger with the expression will save successfully but it will cause the engine to calculate the results incorrectly; the engine may not generate an error but the results will still be incorrect.