Logical

Long ELSE IF chain

An IF chain with four or more ELSE IF links puts every case in the formula; put the cases in a list or mapping module and look them up.

What MaxCheck detects

An IF chain with 4 or more ELSE IF links.

Why it hurts

Every case lives in the formula. Adding or changing a case means editing the formula, and the order of the tests is easy to get wrong.

Example

Taken from the rule's own test cases: formulas it must flag, and formulas it must not.

HintFlags this(four links)

IF A THEN 1 ELSE IF B THEN 2 ELSE IF C THEN 3 ELSE IF D THEN 4 ELSE IF E THEN 5 ELSE 6

Fine (three links)

IF A THEN 1 ELSE IF B THEN 2 ELSE IF C THEN 3 ELSE IF D THEN 4 ELSE 5

How to fix

Put the cases in a list or a mapping module and look the result up, or split the chain into named boolean line items.

Severity
HintShown in the report. Hints never count toward a score.
Area
Logical
Runs in
Basic and full check
Rule ID
L_LONGELSEIFCHAIN
Version
Rule 1.0.0, rule set 1.4.0

Does your model do this?

Upload the line-items blueprint. This rule runs in the basic check, in your browser, with no email.

Check your model