Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Error Post Reply Post New Topic
Author Message
wrenchman123ca
Newbie
Newbie


Joined: 01 Jan 2011
Online Status: Offline
Posts: 3
Quote wrenchman123ca Replybullet Topic: Error
     Posted: 01 Jan 2011 at 6:53am
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
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 03 Jan 2011 at 3:20am
if this is a report just about missing customer numbers, why not make a number table (it can be excel) numbered 1 to the last customer, and perform an outer join between this number table and your data table joined on the customer number.  Report only on the numbers that are NULL...
 
In a command object it would look something like:
SELECT *
FROM NumberTable As nt
  LEFT JOIN DataTable As dt
    ON dt.CustomerNumber = nt.RowID
WHERE dt.CustomerNumber IS NULL
 
HTH
IP IP Logged
wrenchman123ca
Newbie
Newbie


Joined: 01 Jan 2011
Online Status: Offline
Posts: 3
Quote wrenchman123ca Replybullet Posted: 03 Jan 2011 at 11:31am
Thanks for the idea, I had not thought of that. The one table is a brtrieve string and I tried excel but I always get an error masseage saying the fields are not compatible. I have tried changing the excel to text, general or number and nothing seems to work.
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