Solved

Visual C#, Crystal Reporting with Subreports in Multiple columns

Posted on 2009-06-29
10
852 Views
Last Modified: 2013-12-17
Hi Friends,

I am developing a windows application in VS 2008 using C#, and has MS-Access database.
I am using bundled Crystal reporting feature of VS 2008 and I need to design a Crystal report with has 6-7 sub reports and requirement is like report will have two columns Left ( around 3.5 inch wide) and right (around 5 inch wide).

What I need to know is how to design a crystal report with 2 columns and put 4 sub reports in Left section and 2-3 sub reports in right section. Following is rought idea of required layout

--------------------------------------------------------------------------------------------
|                                                  |                                                                       |
|         Sub- Report 1                   |                                                                       |
|  ----------------------------------- |                                                                       |
|                                                  |                                                                       |
|         Sub- Report 2                   |                                                                       |
|                                                  |                                                                       |
|  ----------------------------------   |                   Sub Report 5                               |
|                                                  |                                                                       |
|               Sub-Report 3             |  --------------------------------------------------  |
|                                                  |                                                                       |
|  --------------------------------     |                     Sub Report 6                             |
|                                                  |                                                                       |
|             Sub-Report 4                |                                                                       |
--------------------------------------------------------------------------------------------

moreover Left section will continue to print on only left side even if right hand section has no data to print and same is true vice verse.

Thanks in Advance.


0
Comment
Question by:ArunVashist
  • 6
  • 4
10 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 24741890
Crystal doesn't support multiple columns like that.

The best you can do is put them in the same area with 4 on the left and shrink to 3 inches wide and the others on the left and shrink to fit.

Remember you will have to allow for margins on the printer so you probably only have 8" to play with.  If this willno be printed just displayed you could select the NO PRINTER option and set the margins to 0.

You will need to select the are for the subreport
Group header/footer or detail section

You can add additional sections by right clicking a section in the left margin and clicking INSERT SECTION BELOW

Repeat until you have 4 sections
The reason for this is that when a subreport grows it doesn't push objects in its section job but overwrites it.
You will have something like

DetailA
Subreport 1                                     Subreport 5
DetailB
Subreport 2                                     Subreport 6
DetailC
Subreport 3                                     Subreport 7
DetailD
Subreport4

The main issue is that the subreports in the same section will grow together so if one is larger than the other you will have white space in the other column

For instance
DetailA
Subreport 1                                     Subreport 5
Subreport 1                                     Subreport 5
Subreport 1                                     Subreport 5
Subreport 1
Subreport 1
DetailB
Subreport 2                                     Subreport 6
DetailC
Subreport 3                                     Subreport 7
DetailD
Subreport4

mlmcc
0
 

Author Comment

by:ArunVashist
ID: 24748581
HI mlmcc,

thanks for the reply, well I have already tried this method but it is really not making sense with the layout, as you explained there is lots of wastage of space and reports look weird.

Well is there any way to use nested reports like.. I create a report which includes two sub reports left and right and in turn left and right reports also includes sub reports.

like

main report
Left Section [Sub report ]              Right Section [ sub report ]
     Sub Report 1                             Sub Report 5
     Sub Report 2                             Sub Report 6
     Sub Report 3
     Sub Report 4

I try to use this method but then I am not able to programatically change the datasource of sub reports please guide.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24751636
You can't nest reports.   A subreport cannot have a subreport.

mlmcc
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

Author Comment

by:ArunVashist
ID: 24753105
so there is no way to have two independent column in a report with subreports.
0
 

Author Comment

by:ArunVashist
ID: 24753709
Well Mlmcc,

Can you guide me to design a report which contains 6-7 subreports all fetching data from individual tables and are linked through common keycolumn. like

PatientDetails [PatientId : Pkey]
             |-- FamilyHistory [ PatientId : Fkey ]
             |-- Insurance       [ PatientId : Fkey ]  
|-- Schedule        [PatientId  : Fkey, ScheduleId : Pkey]
|-- PatientMedicine     [ ScheduleId : Fkey ]
|-- Medical Problem   [ ScheduleId : Fkey ]
|-- Review of System [ ScheduleId : Fkey ]
|-- Allergies                 [ ScheduleId : Fkey ]
|-- Assessments       [ ScheduleId : Fkey ]

Now let me explain this.. In our database we have a PatientDetails table which contains personal and contact information about patient, and FamilyHistory table contains details of family members. these table contains information which is collected once and is updated if required.

But in Schedule table we store Date of appointment, patientId and physicianId and use ScheduleId as Fkey in other tables to store data related to particular Date of Service. A patient can have multiple Schedule/Date of service records. and tables like PatientMedicine, MedicalProblem, ReviewOfSystem, Allergies, Assessments stores information for a particular Date of service relevant to PatientId.

Now I am trying to design a report as mentioned above with Left and Right section, where data related to particular date of service will appear on Left ( 5 sub reports) and patient other information will be displayed on right side (2 sub reports). Now I want to know the following things

1.  A good layout to display records
2.  Grouping of report based on PatientId and sub-grouping based on Schedule Id,
     means report shows every Patient data and every schedule data of same patient add a page break and then start printing next patient data.

3. How can I make same report print record of any particular patient and if possible selected patients.

4. How can i make same report print records of selected patient and selected scheduleIds.


thanks in advance

0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24759673
I really don't know.

One idea you can try which will work if you can keep subs 1-4 on 1 page would be to have 7 detail section.  Insert a subreport into each.
You can then format the detail section to use multiple columns.

mlmcc
0
 

Author Comment

by:ArunVashist
ID: 24771626
No desired solutions... so decided to close on my own.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 24774375
As the HELP on closing says, sometimes the answer is It can't be done.  Thus my first comment is probably the answer since I basically said that then made a suggestion that might work.

mlmcc
0
 

Author Comment

by:ArunVashist
ID: 24774699
Ok mlmcc,

my heartiest regards for you and full marks..
0
 

Author Closing Comment

by:ArunVashist
ID: 31598197
Thanks for your expert guidance.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I am very much excited today since I'm going to share something very exciting Tool used for Analytical Reporting and that's nothing but MICROSTRATEGY. Actually there are lot of other tools available in the market for Reporting Such as Co…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question