Collapse
CollapsingX
  • - or -

Comparisons


A comparison is composed of 2 expressions on the sides of the one of the following operators: <, >, <=, >=, =, != and <>.

There are 3 kinds of comparisons: numeric, string, and object comparisons.

Numerical comparisons

The left and right side expressions of the comparison can contain numbers, links, and constant links to inputs/outputs that are not string or object, sub-expressions, operators and functions.

sub1 = 1; sub2 = 0.5;
sub1 = sub2;
CodeReader.Score * 100 = 50;

When the left or right side of the comparison is a simple link and the other side is a simple identifier, the identifier is implicitly considered as one of the constants of the linked input/output. If it is not, it is considered as a sub-expression.

CodeReader.CodeType = UPCA is equivalent to CodeReader.CodeType = CodeReader.CodeType.UPCA because UPCA is a constant of CodeType.

Suppose we have an input speed with 3 constants: Low, Medium, and High.

  • The following example is valid because Low is a constant of Speed.

    SomeStep.Speed > Low is equivalent to SomeStep.Speed > SomeStep.Speed.Low
  • The following example is invalid because maxSpeed is a sub-expression.

    SomeStep.Speed <= maxSpeed

String comparisons

Either the left or right side of the comparison should be a link to a string input/output. The other side can be:

  • Another link to a string. A static string surrounded by "…" (no inline expression).

  • One of the constants of the linked input/output.

  • A constant link to a string.

Sub-expressions are not accepted. The only allowed operators are '=', '!=' and '<>. The following example is invalid because abc is not a constant of DecodedString and sub-expressions are not allowed.

CodeReaderFront.DecodedString = CodeReaderBack.DecodedString "072067400024" != CodeReader.DecodedString CodeReader.DecodedString = abc

Object comparisons

Either the left or right side of the comparison should be a link to an object input/output. The other side can be:

  • Another link to an object of the same type.

  • One of the constants of the linked input/output.

  • A link to one of the constants of the linked input/output.

Sub-expressions are not accepted.

The only allowed operators are '=', '!=' and '<>'.

  • The following example is invalid because you cannot compare objects of different types.

    CodeReader.SearchRegion = IntensityChecker.TestRegion CodeReader.SearchRegion = Metrology.Features
  • The following 2 examples are valid because All is a constant of SearchRegion.

    • CodeReader.SearchRegion = All
    • CodeReader.SearchRegion = IntensityChecker.TestRegion CodeReader.SearchRegion = Metrology.Features
  • The following example is invalid because abc is not a constant of SearchRegion and sub-expressions are not allowed.

    CodeReader.SearchRegion = abc

Cascade comparisons

Cascade comparisons are not supported. The following 2 examples are invalid.

  • 1 < x < 10
  • ROUND(1.5) > 1 = TRUE

To make these 2 examples valid, parentheses are required.

  • 1 < (x < 10)
  • (ROUND(1.5) > 1) = TRUE