Joined: 29 Jan 2014
Online Status: Offline
Posts: 1
Topic: Displaying data in ranges Posted: 29 Jan 2014 at 6:39am
I'm using a database field called PERMISSION.PER_NUMBER to return a list of permit numbers. However, the list is quite long, and I was trying to find a way to condense the list.
For example, if the following numbers were listed in the details section of the report:
100
101
102
103
105
107
108
Is there a formula that could be written that could perhaps display it in ranges?
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 30 Jan 2014 at 5:22am
hmm...interesting request.
I think that you could do something like:
shared stringvar array permit;
shared numbervar lastIndex;
shared numbervar maxSize;
shared numbervar lastPermit;
if lastIndex + 1 >= maxSize then( // check and make sure the array is big enough
maxSize := maxSize + 10;
redim preserve permit[maxSize]
);
in the report header, or the group header, depends on what you have, you would have a reset formula like:
shared numbervar lastIndex := 0;
shared numbervar maxSize:=10;
shared stringvar array permit;
shared numbervar lastPermit := -1;
dim permit[maxSize];
in the report or group footer, you would need a display routine, to mimic what you had as a sample (also set this to Can Grow to accommodate an unknown number of lines):
shared numbervar lastIndex;
shared stringvar array permit;
local numbervar cur;
for cur=1 to lastIndex do(
permit[cur] + chrw(13) + chrw(10);
)
some of my syntax may be off, this is just off the top of my head. Dimensioning an array may be different as I have never done this myself. Arrays in Crystal are not overly helpful, but in htis case I think that they could be the solution.
The general idea is to create an array of strings. Store the first value of a 'run'. Then every time the next permit is in sequence update a counter. Where the numbers are not sequential, the write the range to the array and set the array for the next range.
It's an idea, hopefully it will lead to a solution.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum