I'd like to build a collection, keys = Items (string) and values = backorder
count (longint)

Two synced arrays hold the data: (string) $atItems and (longint)
$alBackorders


This is the code snippet I use:

$myCollection := new global collection

// I'll save the handle in a session to be able to delete the collection
later

session{"myCollection"} := $myCollection

// Now I populate the collection

for each($atItems;$tItem;$i)
     $myCollection{$tItem} +=  $alBackorders{$i})
end for each

Right now I end up with all values in the collection as strings and do not
get the total but rather a string concatenation, if any key exists more than
once. I.e. 3, 8, 5 gives me "385" and not 16.

Tried to declare the collection values as longint with

C_LONGINT ($myCollection)
C_LONGINT ($myCollection{})
C_LONGINT (session{"myCollection"})

but nothing worked.


Any tips are welcome.


Pete


_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://vasudev.aparajitaworld.com/archive/active4d-dev/

Reply via email to