Print Page | Close Window

Creating hierarchical groups at same level

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4892
Printed Date: 05 May 2024 at 4:55am


Topic: Creating hierarchical groups at same level
Posted By: jona
Subject: Creating hierarchical groups at same level
Date Posted: 28 Nov 2008 at 4:21am

Hi everyone,

I am trying to do this in my report :  
 
Let assume :
  • group 1 has 1 record
  • group 2 has 2 record
  • group 3 has 2 record


And in this moment i get this report(if i use group by )

Group 1 record 1
Group 2 record 1
Group 3 record 1
Group 3 record 2
Group 2 record 2
Group 3 record 1
Group 3 record 2


What i want to show in my report is this one

Group 1 record 1
Group 2 record 1
Group 2 record 2
Group 3 record 1
Group 3 record 2

Only after all records of group 2 are shown i want to show the records of group 3 .

Is this so difficult to be done in CR? Can anyone help me on this?

THanks a lot :)



Replies:
Posted By: rahulwalawalkar
Date Posted: 28 Nov 2008 at 4:54am
 
Hi
 
 Can you post some sample data with the required output
 
cheers
Rahul


Posted By: jona
Date Posted: 28 Nov 2008 at 5:04am

ok let suppose this scenario:

You have an invoice. And for this invoice you have a list of creditors wich are part of this invoice and you also have a list of debtors wich are alsi part of this invoice.
 
And i want to have a view like this of my report:
 
Invoice
________________
 
Invoice number: X
Invoice date : X
 
_______________ Creditor_______________(Wich is in fact group 2)
 
1. Creditor 1
2. Creditor 2
3. Creditor 3...
 
_______________ Debtor_______________(Wich is in fact group 3)
 
1. Debtor 1
2. Debtor 2
3. Debtor 3...
 
 
As you can see Creditor And Debtor are group but not under each others they are at same level with invoice .
 
Do you understand me?
 
THanks a lot


Posted By: rahulwalawalkar
Date Posted: 28 Nov 2008 at 6:21am

Hi

Correct me if I am wrong you want to dispay Creditor and Debtor details as per Inovice Numbers.....
 
What I think is you create separate reports for Creditors and Debtors and then include them as subreports in your Main Invoice Number reports link then using the Invoice Number ,place those reports in in two separate groups ,which you can create as FakeGroups using the code below
 
Whilereadingrecords;
""
 
Cheers
Rahul


Posted By: jona
Date Posted: 28 Nov 2008 at 6:30am

Hi , thanks for your reply. The problem is that i cant use subreports because this report is being called in another report as a subreport. In CR subreport after subreports are not allowed. What you think ?

Thanks :)

 



Posted By: rahulwalawalkar
Date Posted: 28 Nov 2008 at 6:44am

Hi

You are correct,can you mail me the sample data ,as i can play around to see if a solution could be found
 
 
mailto:rahulwalawalkar@yahoo.com - rahulwalawalkar@yahoo.com
 
cheers
Rahul


Posted By: jona
Date Posted: 28 Nov 2008 at 7:00am

Hi, what you  meen by sample data? I cant sent you my report in rtf becuse i would have to sent you my schema database aslo. But you can generate a schema like mine if you use a database and choose 3 tables wich have dependence between each others.

I would really appreciate if you try it because i have been searching so much for this problem. Or if  its not a problem for you i hav sent you an invite in yahoo messenger.

Thanks a lot !



Posted By: rahulwalawalkar
Date Posted: 28 Nov 2008 at 7:07am
What I meant by sample data is
 
Few Records with Invoice Numbers with Creditor and Debtor details not entire schema.... also explaining the dependencies so that I can build the tables accordingly with your sample data and test .......
 
Cheers
Rahul


Posted By: jona
Date Posted: 28 Nov 2008 at 7:20am
Ok assume you have 4 tables
Table 1 
Invoice Table
  -id_invoice (PK)
  -Date
 
Table 2
Creditors Table 
   - Id_Invoice(PK)
   -Id_person (PK)
 
Table 3
Debtors table
   -id_Invoice(PK)
   -id_person (PK)
 
Table 4
Person table
  - id_person(PK)
 
1.U can add an invoice number in the invoice table.
2. And then you add some persons in the person table
3. with same invoice number add some persons in the creditors and debtors table
 
and then try to generate the raport with the schema i have told you in the post before
 
Am i clear enaugh?
 
 
Thanks a lot :)
 
 


Posted By: Savan
Date Posted: 28 Nov 2008 at 11:26pm

i think u can get the report using   the sorting option  your sort order should be invoice number -> creditor -> debitor.



-------------
Thanks
Savan


Posted By: rahulwalawalkar
Date Posted: 29 Nov 2008 at 10:22am
Hi

Run a union query on Creditors and Debtors table

select InvoiceId,C_Person from

dbo.Creditor

union

select InvoiceId,D_Person from

dbo.Debtor

order by 2

Invoice ID  C_Person
A111         CP111
B222         CP222
C333         CP333
A111         DP111
B222         DP222
C333         DP333
 
 
 
This will give you output as required you need to display just the second column as invoice id will be used to link the subreport as per your post.
 
hope that helps
 
Cheers
Rahul


Posted By: jona
Date Posted: 29 Nov 2008 at 12:07pm
Hi thanks for yr reply:)
I have a question, you mean to create the union in the database and then do ihave to make any group by in the CR?
Where should i put the fields ? At detail Section?
And my other question is that i will not have Creditors and Debitors in column but under each other like hte example i have shown you? Does this create any problem?
 
Thanks a lot :)



Print Page | Close Window