replace array values to total after merge data

Hi all,

Recently got a question on how too add values after merger instead of the array. I thougt it could be useful.

For example:

X Y Z Name A 1 2 3 Bob B 5 10 15 Carey C 2 4 6 Bob D 10 20 30 Carey

Would become:

X Y Z Name A,C 3 6 9 Bob B,D 15 30 45 Carey

Instead of

X Y Z Name A,C 1,2 2,4 3,6 Bob B,D 5,10 10,20 15,30 Carey


Here is an example showing this behaviour.

for #i in 1 .. numproperties() loop #total := 0;

for #j in 1 .. numvalues(ithproperty(#i)) loop #tmp := ithproperty(#i)[#j];

if isNumber(#tmp) then #total += #tmp;

end if;

end loop;

if #total != 0 then ithproperty(#i) := #total;

end if;

end loop

Cheers
Pedro