# Compare Numeric

This function is used to compare numeric values. An integer or decimal comparison can be performed. Integer comparisons are performed unless the Compare decimal setting is enabled. The source may be a field value, a property value, a named variable's value, a track variable's value or a text string. The compare against field can be a text string, the contents of a named variable or the contents of a track variable.

When any Yate function requires an integer value, any leading integer value is accepted. If there there is no leading integer, zero is assumed. For example an empty string is interpreted as 0 and -123Test is interpreted as -123. The same holds when a decimal value is required. 23.45-abc is treated as 23.45.

This statement has four special compare tests which can be used to validate that a string contains a non empty pure value. Note that leading and trailing spaces are valid. The setting of Decimal compare is irrelevant for these modes. The special tests are:

Is a Number
  Any number will be treated as true. A leading sign and a fraction will be accepted. This test differs from the numeric value determination as is typically performed by Yate. The value will only be true if the entire string being tested is a number. 123.5ABC will return false.
Is an Integer
  Any integer will be treated as true. A leading sign is accepted. This test differs from the numeric value determination as is typically performed by Yate. The value will only be true if the entire string being tested is an integer. 123ABC will return false.
Is a Negative Integer
  Any integer less than zero is treated as true. This test differs from the numeric value determination as is typically performed by Yate. The value will only be true if the entire string being tested is a negative integer. -123ABC will return false.
Is a Positive Integer
  Any integer greater or equal to zero is treated as true. A leading + sign will be accepted. Note that 0 is treated as positive. This test differs from the numeric value determination as is typically performed by Yate. The value will only be true if the entire string being tested is a positive integer. 123ABC will return false.

The statement can also test for true or false. The numeric value which is potentially tested is an integer or decimal value depending on the Compare decimal setting.

Is True
  The text true will return true. A non zero numeric value will return true. Everything else will return false.
Is False
  The text true will return false. A non zero numeric value will return false. Everything else will return true.

When specifying named variables or text you may use any of the escape sequences described in Escape Sequences.

If you specify a result of Set, the action's test state will be set to True or False depending on the result of the test. If you specify a result of And, the action's test state will be set to false if the result of the test is false. If you specify result of Or, the action's test state will be set to true is the result of the test is true.

In stepwise execution mode the following holds:

- If the source is a named variable, the compare function is only performed once.
- If the source is a not a named variable, the compare function is interpreted as for all files unless the Any option is selected.
- A source of text is performed over every file unless the Once option is selected.

You can choose to save the per file results of the test to a track variable. This is not supported when comparing against a named variable. When setting a track variable, the Set, And, Or semantics are applied, therefore cumulative tests will be saved as expected. The result variable will always be a 0 or 1. The Run statement can selectively choose which files are to be executed based on the True or False value of a track variable.