Caché MultiValue Basic Reference
EQS

 Server:docs1 Instance:LATEST User:UnknownUser

 [ Home ]  >  [ MultiValue Features of Caché ]  >  [ Caché MultiValue Basic Reference ]  >  [ Caché MultiValue Basic Functions ]  >  [ EQS ] Go to: Description Examples See Also Search:

Performs an equality comparison on elements of two dynamic arrays.
Synopsis
`EQS(dynarray1,dynarray2)`
Arguments
 dynarray An expression that resolves to a dynamic array of numeric values.
Description
The EQS function compares each corresponding numeric element from two dynamic arrays for equality. It returns a dynamic array of boolean values, in which each element comparison is represented by a 1 (equal) or a 0 (not equal). EQS converts numeric values to canonical form, removing signs and leading and trailing zeros, before making the comparison. EQS does not convert numeric strings to canonical form before making the comparison. If an element is missing, or has a null string value or a non-numeric value, EQS assigns it a value of 0 for the purpose of this comparison.
For two elements to be compared, they must be on the same dynamic array level. For example, you cannot compare a value mark (@VM) dynamic array element to a subvalue mark (@SM) dynamic array element.
If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, unmatched elements return 0 (not equal). That is, the EQS comparison of each element in the longer dynamic array that has no corresponding element in the shorter dynamic array always returns 0 (not equal), even when the value of the longer array element is 0 or the null string, or is a missing element within the dynamic array. You can also use the REUSE function to define behavior when specifying two dynamic arrays with different numbers of elements.
The EQS function is the functional opposite of the NES function.
Examples
The following example uses the EQS function to return an equality comparison for each of the elements in dynamic arrays a and b:
```a=11:@VM:-22:@VM:-33:@VM:44
b=11:@VM:-24:@VM:0:@VM:44
PRINT EQS(a,b)
! returns 1ý0ý0ý1```
The following example compares various element values to 0:
```a=0:@VM:0:@VM:0:@VM:0
b="":@VM:-0.00:@VM:@VM:"foo"
PRINT EQS(a,b)
! returns 1ý1ý1ý1```