Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: Find Gaps in a series of numbers Post Reply Post New Topic
Author Message
Bryan
Newbie
Newbie
Avatar

Joined: 14 Aug 2008
Location: United States
Online Status: Offline
Posts: 10
Quote Bryan Replybullet Topic: Find Gaps in a series of numbers
    Posted: 14 Aug 2008 at 1:06pm
Hi,
 
  Newbie here, and just learning Crystal. I am looking for a way to find the gaps in a series of UPC'S. I have returned a list of the 7th - 11th characters in our UPC and now I need to find the gaps. Can anyone help? Thanks
 
 
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 15 Aug 2008 at 2:05am
Hi,
 
Can you post some sample data.
 
Cheers
Rahul
IP IP Logged
Bryan
Newbie
Newbie
Avatar

Joined: 14 Aug 2008
Location: United States
Online Status: Offline
Posts: 10
Quote Bryan Replybullet Posted: 15 Aug 2008 at 9:47am
Thanks for the response, and sorry about not being clear. Below is some sample data. I have insertes our item #, UPC # (A unique 12 digit number), and then returned only places 7,8,9,10,11 in the seq clumn. There are about 2561 total UPCs, and the 7-11 numbers are the unique value. the 664232 is a prefix, and the last digit is a check digit. So is there a way to find the gaps between each UPC number? Thanks and I apoligize for not explaining it so well. I am pretty new to this stuff. THanks
 
 
Item No                            UPC Cd                       @UPC Seq
 
664232041074
   F10200                          664232041074             4107
 
 
664232041943
   95646-A/I                      664232041943             4194
 
 
664232041981
   95646-C/B                     664232041981             4198
 
 
664232042728
   D1246-O/W                   664232042728              4278
 
 
664232043428
   D1250F-O/W                 664232043428              4342
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 18 Aug 2008 at 4:38am
Hi,
 
What I understand is are you trying to find our missing UPC  numbers when you mean by Gaps between UPC numbers.
 
so after 4107  should be 4108 .4109....... and so on
 
let me know if my assumption is correct,if not please explain a bit more...
 
Cheers
Rahul


Edited by rahulwalawalkar - 18 Aug 2008 at 4:45am
IP IP Logged
Bryan
Newbie
Newbie
Avatar

Joined: 14 Aug 2008
Location: United States
Online Status: Offline
Posts: 10
Quote Bryan Replybullet Posted: 18 Aug 2008 at 9:19am
That is correct. Thanks
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 18 Aug 2008 at 10:11am

Hi,

Create a details section below main details section ,then create a formula and place the code below in that formula
 
if {@UPC Seq} + 1 = Next ({@UPC Seq}) then ""
else
if {@UPC Seq}+2 = Next ({@UPC Seq}) then
"Missing " + totext({@UPC Seq}+1,"0000")
else
"Missing " + totext({@UPC Seq}+1,"0000") + " to " +
totext(next(
{@UPC Seq})-1,"0000")
 
The above formula was taken from the following website ,I have modified to suit your needs
 
 
Once done place the formula in new deatils section .
 
 
Cheers
Rahul
 
IP IP Logged
Bryan
Newbie
Newbie
Avatar

Joined: 14 Aug 2008
Location: United States
Online Status: Offline
Posts: 10
Quote Bryan Replybullet Posted: 18 Aug 2008 at 2:08pm
That was awesome! Worked like a charm. Thanks Rahul
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.031 seconds.