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 seating capacity application detail for any construction involving a theater or cinema; a formula that requires an A/C inspection detail that records the model of air conditioner in a single-family dwelling; or a formula that requires an environmental review detail that records the results of an environmental study of a construction site. You specify an AddOnCondition formula when you define an application, inspection, or review detail.

AddOnCondition formulas use the oBuildingApp object (an instance of the Hansen.CDR.Building.iBuildingApplication 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 BuildingSignature 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 a detail if the declared value recorded in the application is greater than $200,000:


AddOnCondition = False
If (oBldgApp.DeclaredValuation > 200000) Then
  AddOnCondition = True
End If

This formula adds a detail if the application is for an industrial facility:


AddOnCondition = False
If (oBldgApp.OccupancyType.Code.ToUpper = "INDUSTRIAL") Then
  AddOnCondition = True
End If

This formula adds a detail if the application is for a remodel:


AddOnCondition = False
If (oBldgApp.WorkType.Code.ToUpper = "REMODEL") Then
  AddOnCondition = True
End if