I think you missed the point that UV (and it's kin) do *not* compare all strings numerically if possible. It entirely depends on which operation you try to use. That was the example I gave where all the strings are numerically identical and yet the equal test fails.
-----Original Message----- From: Charles Stevenson <[email protected]> To: U2 Users List <[email protected]> Sent: Tue, Jul 24, 2012 6:21 am Subject: Re: [U2] Comparing Two Dyamic Arrays Mike meant NES( ), not EQS( ). nd SUMMATION( ), not SUM( ). UM( ) 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 trings or integer, etc. o UV & its kin makes a best guess. V (& kin? There may be some variance!) will attempt to compare EQ, NE, T, & their ilk the two vars numerically, if possible. hat's what happens with my "seven" example above. All those strings re treated as equal numerically. he related multivalue handling functions, .e.g, EQS, do the same, piece y piece. If one of the two vars can't be treated numerically, then it compares as trings. This is probably as good a general solution as any using "EQ": if len(Array1) EQ len( Array2 ) then ; * because len( ) s so very fast * non-numeric 'x' concatenation forces the 2 to be treated as trings: 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 n 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 ______________________________________________ 2-Users mailing list [email protected] ttp://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
