Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Missing Number in a sequence Post Reply Post New Topic
Author Message
wrenchman123ca
Newbie
Newbie


Joined: 01 Jan 2011
Online Status: Offline
Posts: 3
Quote wrenchman123ca Replybullet Topic: Missing Number in a sequence
     Posted: 06 Jan 2011 at 1:32pm
I have a customer base table that contains a Customer number which is a string field. I found this code online and am tyring to make it founction with my tables. I want to find all the missing numbers is the table. The number start at 1 and go to just under 7000. The number go like this 1,5,6,7,9,10,11,12,15 and so on. I want the report to show a column of missing numbers example 2,3,4,8,13,14 listed in a readable format.
 
The code I am using is
 
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({customer.cus_no}); 
nextemp := tonumber(next({customer.cus_no}));
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,"00000");)
 
I get an error code saying,
 
Error in File F:\Copy of Customer Details.rpt
Error in Formula  <Formula1>
'
'
The string is non-numeric
Details: errorKind
 
any ideas would be helpful
 
Regards
Darrell
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