Sorry
You whant DISTINCT VALUES only for an array.
My solution is only a alternative for the original 4d command.
Gruss, Oliver

> I do all in a 4d method like
> $pArray:=4dDistinctValues(->[table]field1)
> 
> In the 4d method
> I have a case part
> 
> case of
> :(Type($pField->)=Is Text )
>       ARRAY REAL(aDisValText;0)
>       pDisValArray:=->aDisValText
> 
> :(Type($pField->)=Is Real )
>       ARRAY REAL(aDisValReal;0)
>       pDisValArray:=->aDisValReal
> .....
> 
> end case
> 
> DISTINCT VALUES($pField->;pDisValArray->)
> $0:=pDisValArray
> 
> Then you can work with the $pArray witch points to a processVar array.
> 
> 
> 
> Gruss, Oliver
> 
> 
> 
>> Hi,
>> 
>> A4D doesn't support DISTINCT VALUES. What are the common replacements?
>> 
>> I tried this code, it is very slow but inside a 4D database it flies!
>> 4D 2003.3, MacOSX 10.2.8
>> 
>> <%
>> all records([Stock])
>> array text($aMake;0)
>> selection to array([Stock]Make;$aMake)
>> DistinctValues($aMake)
>> %>
>> 
>> In a lib:
>> 
>> method "DistinctValues" (&$inArray)
>> c_longint($k;$NextValue)
>> 
>>  SORT ARRAY($inArray;>)
>> 
>>  $NextValue:=1
>> 
>>  For ($k;2;Size of array($inArray))
>>    If ($inArray{$k-1}#$inArray{$k})
>>      $inArray{$NextValue}:=$inArray{$k-1}
>>      $NextValue:=$NextValue+1
>>    End if
>>  End for
>> 
>>  If ($NextValue<Size of array($inArray))
>>    $inArray{$NextValue}:=$inArray{$k-1}
>>    DELETE ELEMENT($inArray;$NextValue+1;Size of array($inArray))
>>  End if
>> 
>> end method
> 
> _______________________________________________
> Active4D-dev mailing list
> [EMAIL PROTECTED]
> http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
> Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

_______________________________________________
Active4D-dev mailing list
[EMAIL PROTECTED]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to