Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: PRINT MISSING DATA Post Reply Post New Topic
Author Message
aor140
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 9
Quote aor140 Replybullet Topic: PRINT MISSING DATA
     Posted: 07 Oct 2010 at 12:27pm
I am trying to print missing employee numbers ...with the code below, I  can only get the next sequential missing number to print  ... the whole range of missing numbers doesn't print.
 
So if I had employee numbers 82, 95 and 99.. all I'm getting is 83 and 96...and not 83, 84, 85..etc
 
 
Your help would be greatly appreciated...thank you!!
 
 
local numbervar firstemp; // first Emp#
local numbervar nextemp;  // next Emp#
local numbervar diff;     // difference between firstemp and nextemp
local numbervar increase; // increment for missing Emp#'s
local numbervar result;

increase := 0;

firstemp := tonumber({PR_EMPLOYEE_MASTER_1_MC.Employee_Code}); 
nextemp := tonumber(next({PR_EMPLOYEE_MASTER_1_MC.Employee_Code}));

nextemp := nextemp -1;

diff := nextemp - firstemp;

if nextemp = firstemp
then ""
else (

while diff >= 1
do (
diff := diff - 1;
increase := increase + 1;
result := firstemp + increase;

exit while;
);
totext (result,"0000");
)

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Oct 2010 at 3:31am
have you tried removing the exit while...it will is not in an if statement, so it always causes you to exit after the first iteration.
IP IP Logged
aor140
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 9
Quote aor140 Replybullet Posted: 11 Oct 2010 at 4:30am
I have tried removing the exit while and it still doesn't work...however I have changed the formula a little and now have all the missng numbers printing horizontally across the page...the goal would be to get the missing numbers to print vertically...any ideas?
 
thanks for your initial response
 
IP IP Logged
aor140
Newbie
Newbie


Joined: 29 Apr 2010
Online Status: Offline
Posts: 9
Quote aor140 Replybullet Posted: 11 Oct 2010 at 10:16am
solved!!...added chr(13) to the formula and formatted the formula by checking the "can grow" box
 
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