?
Solved

Horizontal Spanning Subreports?

Posted on 2004-08-04
9
Medium Priority
?
889 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 11717618
>>> 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
ID: 11718011
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 2000 total points
ID: 11718096
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
Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

 

Author Comment

by:RuralInstitute
ID: 11944307
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
 
LVL 42

Expert Comment

by:frodoman
ID: 11944333
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
ID: 11944835
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
ID: 11944876
Sounds good - let me know if you run into problems.
0
 

Author Comment

by:RuralInstitute
ID: 11945563
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
ID: 11945586
Glad i could help - frodoman
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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