# Set Trigger Cost for Activities in Scenario Builder Examples

You must have administrator rights to access this feature.

This feature may not be available in every package. Not sure if you have this feature or you want to learn more about it? Send us a message at support@cartegraph.com.

## Set the Cost to the Value One Hundred Thousand Dollars

1. Click >Library Manager.
2. Go to the Protocols library.
3. In the List View, select an existing protocol and click View.
4. In the Triggers section, click Edit.
5. Populate Cost with dollar amount (100000.00).
6. Do not include a dollar sign or commas.
7. Click Save.

When the cost for this activity is calculated during the run of a Scenario, it will be \$100,000 for every asset.

## Set the Cost to an Expression of \$20 * Length of My Pavement Segment

1. For the expression you need the Length Field ID.
2. Click >Structure Manager.
3. Select Pavement in the left panel.
4. In the field list, select the Field Length.
5. Locate the property ID and make note of the ID. For this example, Length.
6. Set the expression as the cost.
7. Click >Library Manager.
8. Go to the Protocols library.
9. In the List View, select an existing pavement protocol and click View.
10. In the Triggers section, click Edit.
11. Create the expression.
12. Write out by hand how you would calculate the value by hand \$20 * length.
13. Length is a quantity field and it is made up of two parts, an Amount and a unit. We want just the Amount part, \$20*length.amount.
14. Substitute the fields in the long-hand version with the field ID and put brackets around it: \$20 * [Length.Amount].
15. Update the numeric value and remove the dollar sign: 20.00 * [Length.Amount].
16. Enter the Cost with that final expression: 20.00 * [Length.Amount].
17. Click Save.

When the cost for an Overlay is calculated during the run of a Scenario, it is based on the length of segment. If the Length field is null for a segment record then a zero is used, so for this expression the cost would evaluate to 0 (20 * 0 = 0 ).

## Set the Cost to an Expression of (\$34.50 * length of my segment) + ( \$30 * number of lanes of my segment)

1. For the expression you will need the ID of the length field and the number of lanes field.
2. Click >Structure Manager
3. In the left panel, select Pavement.
4. In the Field list, select the Field Length.
5. Locate the property ID and make note of the ID. For this example, Length.
6. Locate the property Number of Lanes and make note of the ID. For this example, NumberOfLanes.
7. Set the expression as the cost.
8. Click >Library Manager.
9. Go to the Protocols library.
10. In the List View, select an existing pavement protocol and click View.
11. In the Triggers section, click Edit.
12. Create the expression.
13. Write out by hand how you would calculate the value (\$34.50 * length of my segment) + ( \$30 * number of lanes of my segment).
14. Length is a quantity field and is made up of two parts, an Amount and a unit. We want just the Amount part. So the long hand becomes:(\$34.50 * length.amount of my segment) + (\$30 * number of lanes of my segment).
15. Substitute the fields in the long hand version with the field ID and put brackets around them: (\$34.50 * [Length.Amount]) + ( \$30 * [NumberOfLanes]).
16. Update the numeric value and remove the dollar sign: (34.50 * [Length.Amount]) + (30.00 * [NumberOfLanes]).
17. Populate Cost with that final expression: (34.50 * [Length.Amount]) + (30.00 * [NumberOfLanes]).
18. Click Save.

When the cost for an Overlay is calculated during the run of a Scenario, it is based on the length of segment and the number of lanes of segment.

## Set the Cost to an Expression of \$50 * the Number of Potholes Found During the Most Recent Inspection

The field Number of Potholes is a custom field added to this database as an integer field.

1. For the expression you need to use the lookup field Current inspection ID and the inspection field Number of Pot Holes.
2. Click >Structure Manager.
3. From the left panel, select Pavement.
4. In the field list, select Current Inspection ID.
5. Locate the property ID and make note of the ID. For this example, CurrentInspectionID.
6. Select the Inspections recordset.
7. Locate the field Number of Potholes.
8. Locate the property ID and make note of the ID. For this example, NumberofPotholes.
9. Set the expression as the cost.
10. Click >Library Manager.
11. Go to the Protocols library.
12. In the List View, select an existing pavement protocol and click View.
13. In the Triggers section, click Edit.
14. Construct the expression.
15. Write out by hand how you would calculate the value by hand = \$50 * the number of potholes found during the most recent inspection.
16. The Number of Potholes field is being accessed through the lookup Current Inspection ID. To do that use both field ID's separated by a "\": CurrentInspectionID\NumberofPotholes.
17. Substitute the fields in the long hand version with the field ID and put brackets around them: \$50 * [CurrentInspectionID\NumberofPotholes].
18. Update the numeric value to not have the dollar sign and to be full precision: 50.00 * [CurrentInspectionID\NumberofPotholes].
19. Populate Cost with that final expression: 50.00 * [CurrentInspectionID\NumberofPotholes].
20. Click Save.

When the cost for an Grind is calculated during the run of a Scenario, it will be based on the Number of Potholes found during the most recent inspection.

## Set the Cost to the Condition Expression: If the Segment's Pavement Classification is Brick and Block, an Overlay Costs \$10,000 Otherwise an Overlay Costs \$5,000

1. Set the expression as the cost.
2. Click >Library Manager.
3. Go to the Protocols library.
4. In the List View, select an existing pavement protocol and click View.
5. In the Triggers section, click Edit.
6. Create the expression.
7. Write out by hand how you would calculate the value by hand. = If the segment's pavement classification is Brick and Block the an overlay costs \$10,000 otherwise an overlay costs \$5,000
8. Because we are using a conditional statement we want to put the statement in an if, then, else format. Rewrite your handwritten expression to be in this format: If the segment's pavement classification is Brick and Block then use \$10,000 else use \$5,000.
9. Put the statement in the form of If (What to Check). Then (if true return value) Else(if the check value is false what value should be returned) End_If: If pavement classification is Brick and Block Then \$10,000 Else \$5,000End_If.
10. Convert the conditional statement to the appropriate filter syntax.
11. Click Assets.
12. Make sure you are on the index screen, if you are not (if you are on an asset detail page) then click the Assets link again.
13. Add a layer for Pavement to the list of asset layers. Select Pavement from the Select Asset Type and then click Add.
14. Click .
15. Create the conditional statement in the Advance Filter dialog box.
16. Click .
17. Click Continue.
18. Copy the string in text box: (([PavementClassification] is equal to "Brick and Block")) for use in the next step.
19. Cancel the filter dialog.
20. Return to your hand written expression and substitute this string for the what to check portion of the if-then statement: If (([PavementClassification] is equal to "Brick and Block")) Then \$10,000 Else \$5,000 End_If.
21. Update the numeric value and remove the dollar sign: If (([PavementClassification] is equal to "Brick and Block")) Then 10000.00 Else 5000.00 End_If.
22. Populate Cost with that final expression: If (([PavementClassification] is equal to "Brick and Block")) Then 10000.00 Else 5000.00 End_If.
23. Click Save.

When the cost for an Overlay is calculated during the run of a Scenario, if the pavement classification is Brick and Block, then the cost will be \$10,000; otherwise the cost will be \$5,000.