Branching Rules for Inspection Surveys

Issue/Symptom/Question

Branching Rules for Inspection Surveys

Applies To

Penta for Windows
Service Management
Reference Manual

Resolution/Fix/Answer

Branching

Branching allows you to create inspection surveys that cause PENTA to include or exclude questions based on a survey taker’s response to previous questions asked. For instance, if the survey included several questions about a certain component, you would only want PENTA to ask those questions if the survey taker answered Yes to the question “Is the [component] accessible?”.

To establish branching in a survey, you create “branching rules.” Branching rules allow PENTA to skip over one or more questions within a survey that do not apply to the survey taker.

There are two ways to set up branching rules—“Skip To Question” and “Advanced Branching.”

Skip To Question

The simplest use of branching is when the question has a list of possible answers. In this case, if the survey taker responds with an answer that has an associated Skip To question, the survey branches to that Skip To question. If the survey taker selects an answer that does not have a Skip To question, then PENTA asks the next sequential question.

Advanced Branching

Advanced Branching provides the greatest amount of control and flexibility; however, it is more difficult to set up. When you set up the Advanced Branching rule(s), you must provide:

  1. A rule expression

  1. A question to skip

  1. An (optional) rule name

PENTA assesses the branching rules by the evaluation order—it finds the first rule that evaluates as true and uses the rule to determine which question to Skip To. If PENTA finds no rules that evaluate as true, then it asks the next sequential question.

There is no limit to the number of Advanced Branching rules you can apply to a question.

Notes About Branching

  • You can use Skip To questions and Advanced Branching rules together.

In this case, PENTA executes the Advanced Branching rules first. If there are no Advanced Rules that evaluate as true, then PENTA uses the Skip To question associated with the answer. The reason that Advanced Rules take precedence is because they offer more flexibility. You could create an Advanced Rule that uses answers from the current question and previous questions to determine which question to Skip To. If that complex rule results as false, then PENTA could fall back to the simpler Skip To selection.

  • When to use Advanced Branching instead of a Skip To question:

  • The question does not have a list of possible answers. In the case where the question requires a non-list answer (e.g., an answer in the form of free form text or a number) the only option is to use Advanced Branching.

  • PENTA determines branching based on the value of Unknown or NA. For example, if the answer is Unknown, then skip to question X.

  • Branching requires use of variables to access information in a previous question. For example, if the answer to question 5 is false, then skip to question 10.

  • Branching requires a more complex condition. For example, if the current question is true and question 5 is false, then skip to question 20.

Rule Expression

A rule expression is an expression that results as true or false. For example, the expression 5 > 3 evaluates as true.

Expression Syntax

An expression consists of a combination of rule variables, comparison operators, logical operators, math operators, functions, and constants; however, not all are required in an expression.

You must surround alphanumeric constants with single quotes. You cannot surround numeric constants with quotes.

  • Rule Variables – Allows you to create a rule for PENTA to evaluate based on values the survey taker provides for the current question and/or other questions, answers from previous inspections, or equipment attributes.

  • Branching Results – If a branching rule expression evaluates as True, the inspection logic branches to the question you indicate. A branching rule expression must include one of the following in the Skip To question result:

  • A valid question code

  • END

  • Deficiency Results – If a rule expression evaluates as True, PENTA flags the item as a deficiency.

The table below provides a list of rule variables that the branching rules can use.

Variable

Description

Example

Variable

Description

Example

{Answer} –

Answer value for the current question.

{Answer} = ‘Yes’

{Unknown} –

Boolean value indicating whether the survey taker marked the current question as unknown.

{Unknown} = true

{NA} –

Boolean value indicating whether the survey taker marked the current question as not applicable.

{NA} = true

{Always}

(Only available on Branching) –

Always evaluates as True and therefore always branches to the designated point.

Intended for use when questions exist in groups and you want to branch when reaching the end of a question group.

{Always}

{Prev} –

Answer value for the current question on the previous inspection.

{Prev} = ‘Yes’

{Q.<Code>} –

Answer value for the question with the corresponding code.

{Q.10} = ‘Yes’

{Q.<Code>.Unknown} –

Boolean value indicating whether the survey taker marked the question with the corresponding code as unknown.

{Q.10.Unknown} = true

{Q.<Code>.NA} –

Boolean value indicating whether the survey taker marked the question with the corresponding code as not applicable.

{Q.10.NA} = true

{Q.<Code>.Prev} –

Answer value for the question with the corresponding question code.

{Q.10.Prev} = ‘Yes’

{Q.<Code>.Prev.Unknown} –

Boolean value indicating whether the survey taker marked the question with the corresponding question code as unknown.

{Q.10.Prev.Unknown} = true

{Q.<Code>.Prev.NA} –

Boolean value indicating whether the survey taker marked the question with the corresponding question code as not applicable.

{Q.10.Prev.NA} = true

{InspectionDate}

Date of the inspection.

{InspectionDate} > #1/1/2010#

{Manufacturer}

Value of the equipment’s manufacturer ID

{Manufacturer} = ‘ACME’

{Category}

Value of the equipment’s category code

{Category} = ‘FIREPUMP’

{Capacity}

Value of the equipment’s capacity code

{Capacity} = ‘10K25KCFM’

{Serialno}

Value of the equipment’s serial number

{Serialno} >= ‘A1999’ AND {Serialno} <= ‘A2050’

{VIN}

Value of the equipment’s VIN

{VIN} >= ‘X20333’ AND {VIN} <= ‘X206754’

{Modelid}

Value of the equipment’s Model ID

{Modelid} = ‘X2000’

{Attr.<Attribute_
prompt>}

Value of the equipment’s <attribute_prompt>

{Attr.Location} = ‘FLR2 NE’

  • Comparison Operators – PENTA uses comparison operators in logical statements to determine equality or difference between variables or values.

Given that x=5, the table below explains the comparison operators:

Operator

Description

Example

Operator

Description

Example

=

is equal to

x=8 is false

!=

is not equal

x!=8 is true

>

is greater than

x>8 is false

<

is less than

x<8 is true

>=

is greater than or equal to

x>=8 is false

<=

is less than or equal to

x<=8 is true

  • Logical Operators – PENTA uses logical operators to determine logic between variables or values.

Given that x=6 and y=3, the table below explains the logical operators:

Operator

Description

Example

Operator

Description

Example

&&

and

(x < 10 && y > 1) is true.

||

or

(x=5 || y=5) is false

!

not

!(x=y) is true

( )

Parenthesis used to identify distinct clauses

(x < (y*1.1)) is false

  • Math Operators – PENTA uses math operators to modify a value.

Given that x=6 and y=3, the table below explains the logical operators:

Operator

Description

Example

Operator

Description

Example

+ - / *

Standard math operators, evaluated in standard order of precedence

((x+y)*2) > (x*y)+1 is false

  • Functions – PENTA uses functions to provide extra functionality within the expression.

Function

Description

Example

Function

Description

Example

AddDays

Add a specified number of days to a date.

  • AddDays(#1/1/2010#, 1) is 1/2/2010

  • AddDays(#1/1/2010#, -1) is 12/31/2009

AddMonths

Add a specified number of months to a date.

  • AddMonths (#1/1/2010#, 1) is 2/1/2010

  • AddMonths (#1/1/2010#, -1) is 12/1/2009

AddYears

Add a specified number of years to a date.

  • AddYears(#1/1/2010#, 1) is 1/1/2011

  • AddYears(#1/1/2010#, -1) is 1/1/2009

  • Constants – Constraints are fixed strings or numeric values of your choosing. For example, 7, 115.4, Lennox, etc.

Examples

Condition

Rule Expression

Answer

Result (True/False)

Condition

Rule Expression

Answer

Result (True/False)

Branch if the answer to question 31 is 5 or more

{Q.31} >= 5

4

False

7

True

Branch if the answer to the current question is less than the answer to question 61

{Answer} < {Q.61}

Q 61: 100

 

Current: 88

True

Current: 112

False

Branch if the answer exceeds the answer on the previous inspection by 10% or more

{Answer}>={Prev}*1.1

Prev: 100

 

Current: 103

False

Current:126

True

Deficiency if the manufacturer is ACME and the answer is 5% or more below or 10% or more above the Rated Voltage (an attribute)

({Answer} <= {Attr.Rated Voltage}*.95) ||

({Answer} >= {Attr.Rated Voltage}*1.1)

Rated: 110

 

Answer: 112

False

Answer: 93

True

Answer:128

True

Deficiency if inspection date is more than 5 years from the previous inspection.

(AddYears({InspectionDate}, -5) > {Answer})

where {Answer} is previous inspection date entered

InspectDate: 1/1/2010

 

Answer: 12/31/2004

True

Answer: 1/2/2005

False