[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 892
  • Last Modified:

Horizontal Spanning Subreports?

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
RuralInstitute
Asked:
RuralInstitute
  • 5
  • 4
1 Solution
 
frodomanCommented:
>>> 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
 
RuralInstituteAuthor Commented:
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
 
frodomanCommented:
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
RuralInstituteAuthor Commented:
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
 
frodomanCommented:
You've lost me.  Why not simply link them one at a time as I indicated in my last posting?

frodoman
0
 
RuralInstituteAuthor Commented:
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
 
frodomanCommented:
Sounds good - let me know if you run into problems.
0
 
RuralInstituteAuthor Commented:
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
 
frodomanCommented:
Glad i could help - frodoman
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now