Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Multiple Groups and Record Pairing??? Post Reply Post New Topic
Author Message
jgedwards
Newbie
Newbie


Joined: 07 Jul 2009
Online Status: Offline
Posts: 6
Quote jgedwards Replybullet Topic: Multiple Groups and Record Pairing???
     Posted: 15 Sep 2009 at 7:48am
Good morning.
 
I am using Crystal 8.5 (all I have access to) and am having trouble trying to create the groups I need in my report.  I am querying transaction data from two tables and then also creating some "on demand" sub-reports.
 
Two fields from one table that I am using are transaction date and transaction number.  Transaction number is only unique within a given date, so my first group is on transaction date and my second group is on transaction number.
 
In general, my report returns two rows for each transaction.  Row 1 contains one or more ids in a string that are used to create/link to the sub reports.  Row 2 contains a text string that may occur within multiple transactions.
 
My primary goal is to group on the text string from row 2 and show the Top N (probably top 25).  For each transaction, I need to keep rows 1 and 2 together.  If I only group on transaction date and transaction number, rows 1 and 2 stay together.  As soon as I add a group on the text string in row 2, I lose my row one data. 
 
Is there any way to define row 1 and row 2 as a set and then group the sets by the text string in row 2?
 
Thanks!
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Sep 2009 at 8:13am
So you want:
Row1
Row2.1
Row2.2
...Max
Row2.25
?
Are these on Details A ("row1")and Details B("row2")?
IP IP Logged
jgedwards
Newbie
Newbie


Joined: 07 Jul 2009
Online Status: Offline
Posts: 6
Quote jgedwards Replybullet Posted: 15 Sep 2009 at 9:00am
Originally posted by DBlank

So you want:
Row1
Row2.1
Row2.2
...Max
Row2.25
?
Are these on Details A ("row1")and Details B("row2")?
 

I'm a bit confused by your layout above.  I guess I should have added more detail.  I extract the text string from Row2 into a variable (call it var1) and this is what I actually want to use for my primary group and count/top n.  My other groups are are on tran date and tran num.

I would expect to see the following:
 
var1.1     #of occurrences
  tran_date1
    tran_num1
      row1
      row2
   tran_date2
     tran_num2
       row1
       row2
   tran_date3
     tran_num3
       row1
       row2
  .
  .
  .
var1.2     #of occurrences
  tran_date1
    tran_num1 
      row1
      row2
  tran_date2
    tran_num2
      row1
      row2
 
var1.3     #of occurrences
  tran_date1
    tran_num1
      row1
      row2
 
 
What I actually see now is like the following:
- (this first var is blank and expands to show that it contains all of the "row1" entries for every date and tran num.) 
  tran_date1
    tran_num1
      row1
  tran_date2
    tran_num1
      row1
  .
  .
  . (and so on for each date)
var1.1     #of occurrences
  tran_date1
    tran_num1
      row2
   tran_date2
     tran_num2
       row2
   tran_date3
     tran_num3
       row2
  .
  .
  .
var1.2     #of occurrences
  tran_date1
    tran_num1
      row2
  tran_date2
    tran_num2
      row2
 
var1.3     #of occurrences
  tran_date1
    tran_num1
      row2
 
 
I hope this example helps.  Just to clarify, using "tran_num1" under each "var" does not mean that the same transaction would occur in each "var" group, I am only using it to signify the first transaction listed in that group.  In other words, "tran_num1" may really be number 22 in "var1.1",  but also represent number 159 in "var1.3".
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Sep 2009 at 10:33am
Sorry for the confusion as I left the upper grouping out as it was not the issue.
I am a still confused about a couple of things, mainly around your actual raw data and how it relates to what you are calling "row 1" and "row 2".
Is your raw data compiled via a variable formula to turn something like
1
2
3
into "1, 2 3" and that is what displayed or is your raw data already "1,2,3"?
I guess I don't understand where your "top 25 comes" in because your design I don't see where that is able to be used.
I would think you are suppressing yuopr details and compiling them into a varchar variable and dsiplaying on a footer but it is not clear to me.
IP IP Logged
jgedwards
Newbie
Newbie


Joined: 07 Jul 2009
Online Status: Offline
Posts: 6
Quote jgedwards Replybullet Posted: 15 Sep 2009 at 11:26am
Here is the actual data I use:
 
MESSAGE table
MESSAGE_HIST table
 
The two tables above are joined on tran_date and tran_num.  As far as the Details section goes, I am displaying the following fields from the corresponding tables:
 
MESSAGE.tran_date
MESSAGE.tran_num
MESSAGE.source
MESSAGE_HIST.que_line_id
MESSAGE_HIST.details
 
I've created 7 formula fields:
1.  OFAC_IDs - this field has a formula that extracts all of the OFAC IDs from certain MESSAGE_HIST.details records and then concatenates them together with a comma separating each.  There can be no more than 5 OFAC IDs for a given transaction.
 
2.  Stop_Entity - this field is the text string that is extracted from certain MESSAGE_HIST.details records.
 
3.  The remaining formula fields are labeld ID1, ID2, ID3, ID4 and ID5.  These fields are not displayed in the Details section, but are used to create subreports.  If an ID field is not null, a subreport is created.
 
Here is my select statement:
 
(({MESSAGE_HIST.QUE_LINE_ID} in ["STOP_ADM_LOG", "STOP_PAY_LOG"]) or
({MESSAGE_HIST.QUE_LINE_ID} = "*SYS_MEMO" and
(InStr ({MESSAGE_HIST.DETAILS}, "FLD")>0 or InStr ({MESSAGE_HIST.DETAILS}, "MATCH REF:")>0))) and
{MESSAGE.TRN_DATE} in DateTime (2008, 02, 11, 00, 00, 00) to DateTime (2008, 02, 16, 00, 00, 00) and
{MESSAGE.STOP_INTERCEPT} in ["O", "S"]
 
For each transaction, there may be zero or more MESSAGE_HIST.DETAILS records with the "MATCH REF:" string or the "FLD" string, but normally there are only two (one of each).  The record containing the "MATCH REF:" string is the one that provids the OFAC IDs, and the other record provides the text string that I extract for the Stop_Entity formula field.
 
I want to group on the Stop_Entity field so that I can see which text strings reoccur the most.  I then need the ability to drill down to see the subreport.
 
I think my issue is that the data needed to group on Stop_Entity comes from the record with "FLD" and the data needed to create the subreport (that accesses data from another table that can not be linked to the two tables above) comes from the record with the "MATCH REF:".
 
I hope I have not added more confusion with all of this detail.  I am a novice at Crystal and don't know what else to do.
 
Thanks.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Sep 2009 at 12:06pm
Wacko
I do not think you want any more grouping past your first 2 levels (date and transaction#).
As you noted it breaks your data up if you group more than that.
Where I think you need to focus on is how to use crystal to display the remaining data and rows that fall into that grouping the way you want it.
Likely you will want to make your "row1" on Groupfooter2a and "row2" on GF2b.
I am assuming that your formula OFAC_IDS is a crystal formula and is a variable that needs to be placed on a footer to show all the results but this is where I keep getting lost.
 


Edited by DBlank - 15 Sep 2009 at 12:07pm
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 15 Sep 2009 at 12:21pm

Keep in mind that grouping does not alter the number oif rows that you have it just splits them up (and sorts them).

You can use formating to hide the rows as you see fit (and based on a logic).
I try to "see" the entire report with all rows shown. Once you start to group leave the details as being shown. From there see how you can hide or show each row as needed.
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