Peter,
I had a similar observation.
I call my own ARR_GetDistinct(Array Pointer) 4D method from Active4D. To do this I also use BASh' DSS variables to get and dispose of the Array Pointer.
<% c_pointer ($aMakePTR) $aMakePTR := DSS_Get_Variable_by_Type (text array) `` this is a 4D method all records([Stock]) ARR_CLEAR ($aMakePTR->) ` this is a 4D method selection to array([Stock]Make;$aMakePTR->) ARR_GetDistinct($aMakePTR) ` this is a 4D method DSS_Return_Variable($aMakePTR) ` this is a 4D method %>
It does require having code in 4D and Active4D, but works well.
-- Brad Perkins
At 08:28 07/01/2004, you wrote:
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 --
Greetings, [4D-Consulting.com]eK, Wiesbaden Peter Schumacher -------------------------------------------------------- Web: http://www.4D-Consulting.com/ AIM/iChat: PeterInWiesbaden 0800-4D-Infos / 0800-43.46.367 - Fax: 0800-43.46.637 Intl +49-611-9406.850 - Intl: +49-611-9406.744 _______________________________________________ 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/
