Solved

Horizontal Spanning Subreports?

Posted on 2004-08-04
9
882 Views
Last Modified: 2008-02-01
Hello Experts,

I have been plotting for the best course of action for the next series of reports in a project and have gotten stuck.  I am trying to do something like this:

_______________________________________________________________________________________________________________
|Budget Categories|                        |Account1|                                             |Account2|                                                |AccountN|
------------------------------------------------------------------------------------------------------------------------------------------------------------

                                |Budget| |Transactions| |Balance|              |Budget|  |Transactions| |Balance|                   |Budget|  |Transactions| |Balance|
Wages/Salary             $XX.xx       $XX.xx            $XX.xx                $XX.xx       $XX.xx            $XX.xx                     $XX.xx       $XX.xx            $XX.xx
Benefits                      $XX.xx       $XX.xx            $XX.xx                $XX.xx       $XX.xx            $XX.xx                     $XX.xx       $XX.xx            $XX.xx
etc.                            $XX.xx       $XX.xx            $XX.xx                $XX.xx       $XX.xx            $XX.xx                     $XX.xx       $XX.xx            $XX.xx


The number of accounts varies, anywhere from 1 to n.  The values are based on a primary key, so each Budget and Transaction can be retrieved using the same stored procedure.  I have read that the best (and it seems only) way to span horizontal pages is with crosstabs.  Can I feed some varying amount of subreports into a cross tab?  Any other ways of thinking that I'm missing?  Your input is greatly appreciated.
0
Comment
Question by:RuralInstitute
  • 5
  • 4
9 Comments
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
>>> I have read that the best (and it seems only) way to span horizontal pages is with crosstabs.

This is correct.

>>> Can I feed some varying amount of subreports into a cross tab?

No.


The way to do this I believe is to have the information for each account be a subreport.  Create a subreport that shows this information for a single account based on a parameter (account number?).  Have your main report pass the value to the subreport.  Size your subreport to be 1/3rd of the page width and place it in the details section of the main report.

In the main report use Report -> Section Expert -> Details -> Format for Multicolumn.  Then click the layout tab and enter the width as 1/3 of the page width.

This will give you a layout like this:

[ SUBREPORT1 ]   [ SUBREPORT2 ]   [ SUBREPORT3 ]
[ SUBREPORT4 ]   [ SUBREPORT5 ]   [ SUBREPORT6 ]
etc.

As long as you can pass some parameter from the main report to the subreport this will work.  I've tested with CR9 so it should work there or later.  I believe it'll work on older versions as well but I haven't tested.

This is over-simplified - it's going to take some tweaking to look right but hopefully this is enough info to get you on track.

frodoman
0
 

Author Comment

by:RuralInstitute
Comment Utility
So a single report with one paramter value (accountNumber) taking up one third of the page sounds like a good idea.

However the collection of paramterValues I give the report viewer will have multiple accountNumbers (a.k.a that which defines what data is returned).  Is Crystal smart enough to take each of the accountNumbers and apply them to the same subreport, especially since the parameter value name is only defined once?

Sorry this sounds so crazy, I'm having a hard time explaining it.  The hardest part about these reports is the accountants want them to look EXACTLY like the old ones.  Thanks for your help.
0
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
Comment Utility
Main report has one parameter which will contain multiple values, right?  These values are the list of account number(s) that should appear on the report?  If that's correct then that is exactly the scenario I was working with.

To test it, create a report that prompts for the parameter.  In your details section put only the account number field from your database.  Preview the report and enter three valid values for the parameter and you should see a report that looks something like this:

RH:
PH:
  D: account#1
  D: account#2
  D: account#3
PF:
RF:

Now insert another details section and create your subreport as described above and put it in details B.  Link {table.accountnumber} from main report into the parameter of your subreport - DON'T LINK THE MAIN REPORT PARAMETER TO THE PARAMETER OF THE SUBREPORT - that will get you a mess in this case.  This should give you this:

RH:
PH:
  Da: account#1
  Db: [subreport for account#1]
  Da: account#2
  Db: [subreport for account#2]
  Da: account#3
  Db: [subreport for account#3]
PF:
RF:

Now do the multicolumn stuff and suppress detail A and you're 90% of the way there.

frodoman
0
 

Author Comment

by:RuralInstitute
Comment Utility
I have been on Crystal haitus for the last couple weeks.  I am now getting back into this - and again my brain is freezing.  I'm trying to figure out the best way to pass all the accounts in.  I get the accounts using a stored procedure, and right now they are sitting in a datatable.  My thought is to add multiple discrete values to a given parameter - is this the best way to go about it?  Here is what i'm thinking so far.

     ParameterFields paramFields = new ParameterFields();
     ParameterField paramField = new ParameterField();
     paramField.ParameterFieldName = "@bannerIndexCode";
           
          for(int i = 0; i < myTable.Rows.Count; i++)
      {
                string currentDiscValue = "discreetValue" + i.ToString();

                //autoNames each discrete value so there is no overwriting - had problems with this before...
      ParameterDiscreteValue currentDiscValue = new ParameterDiscreteValue ;

                currentDiscValue.value = myTable.Rows[i].Value.ToString(); //Not sure of code here but you get the idea

                paramField.Add(DiscValue);
      }

                paramFields.add(paramField);

My thought is by the time Crystal gets the parameterField Collection it will have the multiple account codes.  Sorry for making you work backwards like this but it always seems easier in my mind than it is to actually apply it.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 42

Expert Comment

by:frodoman
Comment Utility
You've lost me.  Why not simply link them one at a time as I indicated in my last posting?

frodoman
0
 

Author Comment

by:RuralInstitute
Comment Utility
Ok Frodoman, I don't know what I was thinking with that last post, sorry.  *Doh*  As you suggested I just call the stored procedure that takes a parameter (called unitname) and returns a series of account numbers.  When i put it in the details section it spit out 3 account codes (which is correct).  Now I'm working on linking them to the sub-reports.
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
Sounds good - let me know if you run into problems.
0
 

Author Comment

by:RuralInstitute
Comment Utility
That was great.  I dont know if I would have figured that out on my own.  Thanks a million.

I'm going to post another question about getting the multi-column formatting to stick, but I wanted to get you the points for the original question.

Thanks!
0
 
LVL 42

Expert Comment

by:frodoman
Comment Utility
Glad i could help - frodoman
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now