Populate an array with only unique values

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Is there an easy way to populate an array variable with only unique values from a field? No specific order is necessary.
I found a way:

WhileReadingRecords;
StringVar Array ArticlesVar;
NumberVar i;

IF NOT ({db.ArtNr} IN ArticlesVar) THEN
(
    i:=i+1;
    ReDim Preserve ArticlesVar [i];
    ArticlesVar[i]:={db.ArtNr};
);