Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Identify duplicate records between subreports Post Reply Post New Topic
Author Message
sandy
Groupie
Groupie


Joined: 10 Jan 2007
Location: United States
Online Status: Offline
Posts: 45
Quote sandy Replybullet Topic: Identify duplicate records between subreports
     Posted: 23 Mar 2009 at 10:40am
I have a main report which has a table that stores a request number.  I have an unlinked subreport  as well that contains several tables (one of which holds the same request number as the one located in the main report.  What I would like to do is not show the second record that would come from the subreport if is is already being selecting and displayed in the main report.  Is that possible?  Ex:  Main report has Request number 558 and 559.   Subreport has records of other data that is needed but one of the records contain the request number 559.  I do not want to show that record in the subreport.  Can this be done?
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Mar 2009 at 1:34pm
You could build a shared string variable with a delimiter and all the request numbers that the Main report has processed.  The subreport could then pick up the string and see if the request number it is processing has already been processed and respond accordingly.
 
Hope this helps
IP IP Logged
sandy
Groupie
Groupie


Joined: 10 Jan 2007
Location: United States
Online Status: Offline
Posts: 45
Quote sandy Replybullet Posted: 24 Mar 2009 at 9:31am
Thanks for the e-mail.
I did some research, would this be what I need to do:
//capture Request Numbers
numbervar recordcounter;
stringvar array SRNOS;
recordcounter :=UBound(SRNOS) + 1;
redim Preserve SRNOS[recordcounter];
SRNOS[recordcounter]:={@Convert SRNo to string};
 
I did this and placed it in the detail section but it just returns my request no for that record.   I am not understanding why the request nos are not being saved since I am using the preserve keyword
 
I figure I would then need to create a delimited string from that array
stringvar joinedstring := join(SRNOS,"|");
But this code is returning that I am missing a )
 
Am I anywhere on the correct path???
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 25 Mar 2009 at 6:10am
The request number snippet is saving the numbers to an array, if you want to suppress the duplicates you need to search the array.  I don't use arrays too often, but I am sure it is not hard to find code to check the array.  My simple minded approach would be to loop through the array.  anyhow, the reason that you get the request back, is that is the last item 'displayed' in the formula...if you add "" it will suppress the reporting.
 
To create a delimited string, you don't need the array...you can just use:
stringvar joinedstring := joinedstring + "|" + {@convert SRNo to string};
 
for true paranoia, you can add + "|" to the formula, then to check for if it has been used before you can use:
stringvar joinedstring;
if instr(joinedstring, "|"+{@convert SRNo to string}+"|") > 0 then ...
 
Hope this helped
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