Link to home
Start Free TrialLog in
Avatar of RuralInstitute
RuralInstituteFlag for United States of America

asked on

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.
Avatar of frodoman
frodoman
Flag of United States of America image

>>> 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
Avatar of RuralInstitute

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of frodoman
frodoman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
You've lost me.  Why not simply link them one at a time as I indicated in my last posting?

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