Print Page | Close Window

Populate an array with only unique values

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=21974
Printed Date: 03 May 2024 at 4:58am


Topic: Populate an array with only unique values
Posted By: pbengtss
Subject: Populate an array with only unique values
Date Posted: 22 May 2016 at 10:49pm
Is there an easy way to populate an array variable with only unique values from a field? No specific order is necessary.



Replies:
Posted By: pbengtss
Date Posted: 23 May 2016 at 2:17am
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};
);



Print Page | Close Window