Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: List numbers between two numeric fields Post Reply Post New Topic
Author Message
karad
Newbie
Newbie


Joined: 11 Mar 2010
Location: United States
Online Status: Offline
Posts: 2
Quote karad Replybullet Topic: List numbers between two numeric fields
     Posted: 11 Mar 2010 at 1:25pm
I have to generate the Holes between values in two fields in a table

Start_num  End_num
      0                   0
      1                   1
      2                   2
      3                   3
      5                   5
      6                   6
      7                   7
    10                 10

I would like the following values returned

      4
      8
      9
   

I currently have the following formula

whileprintingrecord;
numbervar Hole := {table.End_num} +1;
while Hole < (next({table.Start_num} -1) Do
(
Hole := Hole +1;
);
Hole


Any guidance would be appreciated, seems like maybe I need to store the values in an array then print them in my report.  I am still getting the hang of crystal syntax.


Edited by karad - 11 Mar 2010 at 1:56pm
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet Posted: 11 Mar 2010 at 1:40pm
You could use either next Previous or Next and create some logic to insure it is +1 or -1 as a comparison, then print accordingly. You would need the right logic to move through the records.
 
This syntax will not be correct but may get you thinking, it comes from the  a sample in the CR Help file:
 
If Next({file.QTY})<>0 Then
     {file.QTY}/2
Else
     {file.QTY}
 
Hope this is of some help.
 
Regards
 
John W.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 11 Mar 2010 at 2:03pm
Not my area of comfort but here is a similar post but dealing with dates that might give you help...
 
You will have to get the '4'  seperate from the '8 and 9' and you will have to convert them all to text becasue the 8-9 will be in the same text display (same as the example but with dates).
IP IP Logged
karad
Newbie
Newbie


Joined: 11 Mar 2010
Location: United States
Online Status: Offline
Posts: 2
Quote karad Replybullet Posted: 11 Mar 2010 at 2:07pm
Thanks, I was just looking at that post also, similar to what I want to do.
IP IP Logged
Printable version Printable version

Forum Jump
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