Mike meant  NES( ),  not  EQS( ).
and SUMMATION( ),  not SUM( ).
SUM( ) won't yield a scalar unless all delimiters are the same.

      ResultArray =  NES(Array1, Array2)
If summation(ResultArray)=0 then samething = true else samething = false

Which is all well and good . . . as long as you consider "7" = "7.00" = "007" = " 7."
____________

To address Bill Brutzman's original question:

The trouble is that we don't _declare_ variables in UV/UD/MV Basic as strings or integer, etc.
So UV & its kin makes a best guess.
UV (& kin? There may be some variance!) will attempt to compare EQ, NE, GT, & their ilk the two vars numerically, if possible. That's what happens with my "seven" example above. All those strings are treated as equal numerically. The related multivalue handling functions, .e.g, EQS, do the same, piece by piece.

If one of the two vars can't be treated numerically, then it compares as strings.

This is probably as good a general solution as any using "EQ":

if len(Array1) EQ len( Array2 ) then ; * because len( ) is so very fast * non-numeric 'x' concatenation forces the 2 to be treated as strings:
         samething = ( ( 'x': Array1 ) EQ ( 'x': Array2 ) )
      end else
         samething = @false
      end

i don't know how the speed compares to COMPARE(), which is simpler to read.

-- Chuck


On 7/23/2012 3:46 PM, Bill Haskett wrote:
I'm not sure this would work, as the UniData documentation for "EQS" states:

The UniBasic EQS function compares each value in array1 to its corresponding value in array2. UniData returns an array with 1 in each position where values are
equal, and 0 in each position for values that are not equal.

Thus, if the following...

ARRAY1 = '11':@VM:'12':@VM:'13':@VM:'20':@VM:'21'
ARRAY2 = '11':@VM:'12':@VM:'13':@VM:'19':@VM:'22'
ARRAY3 = EQS(ARRAY1,ARRAY2)

...then the resultant ARRAY3 would look like:

'1':@VM:'1':@VM:'1':@VM:'0':@VM:'0'

On the other hand, the following...

ARRAY1 = '11':@VM:'12':@VM:'13':@VM:'20':@VM:'21'
ARRAY2 = '11':@VM:'12':@VM:'13':@VM:'20':@VM:'21'
ARRAY3 = EQS(ARRAY1,ARRAY2)

...would assign ARRAY3 to look like:

'1':@VM:'1':@VM:'1':@VM:'1':@VM:'1'

...and:

SUM(ARRAY3)

...would equal 5, which would only indicate equality if

SUM(ARRAY3) = DCOUNT(ARRAY3, @VM)

Does this make sense? With mixed @AMs & @VMs I suspect one would have to loop through the result array comparing.

Is UniData different than UniVerse?

Bill


------------------------------------------------------------------------
----- Original Message -----
*From:* [email protected]
*To:* U2 Users List <[email protected]>
*Date:* 7/23/2012 1:17 PM
*Subject:* Re: [U2] Comparing Two Dyamic Arrays
Try:
ResultArray =  EQS(Array1, Array2)
If sum(ResultArray)=0 then samething = true else samething = false
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to