Table of Contents

Code action DR014 (Readability) Simplify using IN

Description

Rewrite compound predicates (equality comparisons of the same expression that are combined using OR or ||) with the IN operator.

Example

Change:

IF(Document[Type] = "Invoice" || Document[Type] = "Credit Note", 1, 0)

To:

IF(Document[Type] IN {"Invoice", "Credit Note"}, 1, 0)

Why is Tabular Editor suggesting this?

The IN operator is more concise and easier to read than multiple || operators or OR function calls. It also makes it easier to add or remove values from the list of values to compare against.