Understanding Criteria (the If Clause)

Criteria must always evaluate to either true or false. A criteria statement can contain logical operators, such as ==, >, >=, <, <=, or != to evaluate if a statement is true or false, and can also call functions that return true or false (Criteria Examples with Single Operators).

Table 1. Criteria Examples with Single Operators
Criteria Description
true If you use a true as the if clause, the specified action always executes.
appMatch(“Building/Commercial/*/*”)
The appMatch function returns true or false depending on whether the current record type matches the record type in the function parameter. The asterisks (*) indicate a wildcard. In this example, any record types that start with Building/Commercial return a true.
!appMatch(“Building/Commercial/*/*”) 
appMatch(“Building/Commercial/*/*”) != true 
These two examples mean the same thing, with different syntax.Both say, if the current record type is not under Building/Commercial do the action.
inspType == “Final Inspection”
Use double equals (==) check whether a value equals another variable or a string. In the example, if the value for the
inspType
variable of the triggered event equals “Final Inspection” then execute the associated action.
{STRUCTURE DETAILS.Total Square Feet} >= 2000
You can use criteria to test the value of an Application Specific Information. In the example, if the value of the ASI field name Total Square Feet within the ASI subgroup STRUCTURE DETAILS equals or is greater than 2000, then execute the action.A period delimits the ASI subgroup name which precedes the ASI field name.
Note:

You can configure a global variable to precede all ASI field names with the ASI subgroup name.

{ParcelAttribute.Neighborhood} == “Downtown Area”}
Similar to ASI fields, enclose a parcel attribute in curly brackets, and prepend it with ParcelAttribute and a period separator. In the example, if the parcel attribute Neighborhood equals Downtown Area then execute the associated action.
proximity(“GIS”,”Schools”,parseInt({Number of feet}));
Similar to the appMatch function example, the function proximity returns true or false. The function checks to see if the parcel for the current record falls within a buffered distance on a layer within GIS. The example checks whether the current record’s parcel is within a certain number of feet (a value specified in an ASI field).
!taskStatus(“Permit Issuance”,”Issued”);
The taskStatus checks to see if a workflow task currently has a particular status. The example checks to see if the status of the permit issuance task updated to issued. You can use this type of check to prevent inspection scheduling before permit issuance.

Topics:

Understanding Criteria with Multiple Conditional Statements

Criteria (the if clause) can contain multiple conditional statements separated by the logical “and” operator (&&) and/or the logical “or” operator (||). All “and” conditions must be true in order for the criteria to be true. Only one “or” condition needs to be true in order for the criteria to be to true.

You can use as many logical operators in your criteria as you need to satisfy your business rules. You use parenthesis to specify the evaluation order of criteria with multiple conditions and multiple operators (Criteria Examples with Multiple Operators).

Table 2. Criteria Examples with Multiple Operators
Criteria Description
inspType == “Final Inspection” && !isScheduled(“Electrical”)
This condition occurs during an inspection event. The criteria checks whether the inspection type that triggered the event is a final inspection and whether Civic Platform scheduled an electrical inspection.You can use this criteria during an InspectionScheduledBefore event to prevent a final inspection before an electrical inspection.
feeExists(“LICFEE”) && balanceDue <= 0
This condition checks to see if the fee item LICFEE exists on the current record and whether the balance due on that fee item is less than or equal to 0.You can use this condition to ensure that the license includes the required license fee and that the applicant does not owe any fees.Master scripts set the balanceDue variable before Civic Platform evaluates the script controls.
wfTask == “Supervisor Review” && (wfStatus == “Approved” || wfStatus == “Not Required”)
This criteria uses parenthesis to evaluate the “or” clause before evaluating the “and” clauses. The criteria says, If you update the Supervisor Review task to Approved or Not Required, do the associated action.An alternative way to write this criteria is: wfTask == “Supervisor Review” && matches(wfStatus,”Approved”,”Not Required”).
Note:

The matches function works similarly to a SQL IN clause. It is checking to see if the value in the first parameter is equal to any of the following parameters.