Calculating whether to add a detail

You can use an AddOnCondition formula to calculate whether to add a detail to an application, inspection, or review. For example, you could write a formula that requires a tax assessment application detail for any construction involving a commercial facility; a formula that requires an A/C inspection detail to record the model of air conditioner used in a condo complex; or a formula that requires a proximity review detail to record any public gathering places near the construction site for an industrial complex.

AddOnCondition formulas use the oProjectApp object (an instance of the Hansen.CDR.Project.iProjectApplication class) to set AddOnCondition to either True or False.

You can also use properties and methods of the detail objects in your formula. For example, you might want to specify the detail types that the formula applies to. To access detail properties, select the ApplicationDetail, InspectionDetail, or ReviewDetail node under ProjectSignature in the Methods and Properties tree. You must also use the AssociatedRecordType node to indicate the type of record, such as AssociatedRecordType.InspectionDetail.

For more information, and for sample code, click the Information tab in the Formula Editor.

Examples

This formula adds an item if the declared value recorded in the application is greater than $500,000:

AddOnCondition = False
If (oProject.DeclaredValuation > 500000) Then
  AddOnCondition = True
End If

This formula adds an item if the application has a High priority and a Stop Work application status:

AddOnCondition = False
If (oProject.Priority.Code.ToUpper = "HIGH") And (oProject.ApplicationStatus.ToUpper = "STOPWORK") Then
  AddOnCondition = True
End If

This formula adds an item if the application is for a new construction:

AddOnCondition = False
If (oProject.WorkType.Code.ToUpper = "NEW") Then
  AddOnCondition = True
End if