Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subreport Question 1

Status
Not open for further replies.

metalteck

MIS
May 10, 2006
54
US
I am using crysal 8.5.
I have my main report that breaks down the productivity of a class by groups, 0-30, 31-60, etc.
Ex. Class 0-30 31-60 61-90
A 1.00 25.00 100.00

I have another report that breaks down the class based on budgets. Ex.
Class Budget
A 15,000

I placed the second report as a subreport to the main one, but what i would like to know is how I can get certain data from the subreport to appear in the main one.
I want the report to be able to look like this;

Class Budget 0-30 31-60 61-90
A 150000 5.00 25.00 60.00

Please help

 
You have to add the group condition to the sums--whatever field you are grouping on (the class field, whatever that is), as shown in my previous post. Also I made up the names for your fields, since you haven't said what they are. Use your actual field names.

I feel like you are stringing me along, asking one question at a time. Please lay out your requests all at once, and try to take the time to be specific about what you mean. It seemed that you wanted a total of all fields per group, and now you want a grand total of this total?

-LB
 
I'm sorry, in no way am I trying to string you along.
I work on the topic and then another questions surfaces while i'm doing my work. I'm relatively new to crystal and am taking crystal class next month.

Ok, I have two questions:
1. When i generate my subtotals per line item, and place them in the group header, I get the correct totals, but the results are skewed. The correct answer appears one line below where it is supposed to be. Let me show you:

Class 0-30 31-60 61-90 Subtotal
A 1000 2 3 0
B 5000 50 20 1005.
C 8000 1000 100 5070 etc...

this is my code:

whileprintingrecords;
shared numbervar acct;
numbervar totacct:= acct + sum({@0-30count},{BADPLPP.LPFC}) + sum({@31-60count},{BADPLPP.LPFC}) + sum({@61-90count},{BADPLPP.LPFC}) + sum({@91-120count},{BADPLPP.LPFC}) + sum({@121-180count},{BADPLPP.LPFC}) + sum({@181+count},{BADPLPP.LPFC});

2. When I try to calculate my grand totals I get a complete wrong number. Here is the code for this:

whileprintingrecords;
shared numbervar acct;
numbervar totacct;

numbervar grtotacct:= grtotacct + totacct;

Can you please tell me where I am going wrong and thank you for your diligence and patience for me.

Thank you
 
When you are using variables as manual running totals, then the results will only be correct in the group footer. You can handle this by dragging your groupnames into the corresponding group footer, and displaying that instead of the group header.

Where are you putting your grand total formula? You should just change your formula where you are calculating the group total to:

whileprintingrecords;
shared numbervar acct;
numbervar totacct;
numbervar grtotacct;

totacct := acct + sum({@0-30count},{BADPLPP.LPFC}) + sum({@31-60count},{BADPLPP.LPFC}) + sum({@61-90count},{BADPLPP.LPFC}) + sum({@91-120count},{BADPLPP.LPFC}) + sum({@121-180count},{BADPLPP.LPFC}) + sum({@181+count},{BADPLPP.LPFC});
grtotacct := grtotacct + totacct;
totacct;

Then in the report footer add the following formula:

whileprintingrecords;
numbervar grtotacct;

-LB
 
Just wanted to thank you for all of your help.
It has been a great learning experience.

Thank you again.
 
I'm trying to calculate a shared variable from a subreport to other values in the main report. I've been able to calculate the subtotal and placed it in the group footer. My only problem is that when I do that, a 0 is placed in the first subtotal value, causing all my totals to be associated with the class underneath them.

All of my subtotals are placed in Group Footer 1b.

This is the formula I have in Group Footer 1c, because I need it to run before the main report, so that it calculates the subreport subtotals along with the other corresponding subtotals.

whileprintingrecords;
shared numbervar acct;
numbervar totaccts;

totaccts:= acct +Sum ({@0-30count}, {BADPLPP.LPFC})+Sum ({@31-60count}, {BADPLPP.LPFC})+Sum ({@61-90count}, {BADPLPP.LPFC})+Sum ({@91-120count}, {BADPLPP.LPFC})+Sum ({@121-180count}, {BADPLPP.LPFC})+Sum ({@181+count}, {BADPLPP.LPFC}) ;
totaccts;

After running this formula, all of my subtotals are correct, the only problem is that they are in a row below where all of my information is. I want to place all of my totals on one line.

In Group Footer 1b, I placed this formula so that everything is on one line:
WhilePrintingRecords;
numbervar totaccts;

When I do this, the extra 0 is added to my totals?

Class IH 0-30 31-60 Subtotal
A 1000 20 30 0
B 2000 20 30 10050
C 3000 20 30 20050

You helped me solve this problem by moving everything from the group header to the group footer. Now I have no idea how to solve this. Can you give me any help?
 
WHERE did you place it in the report? What section?

-LB
 
Remove the shared variable formula from GF1_b, and place it in GF1_c. Then go to the section expert and format GF1_b to "underlay following sections". This will cause the shared variable formula in the GF1_c section to align with the fields in GF1_b.

-LB
 
Hi lbass, great feedback. Up for helping another?

We are trying to keep our report running efficiently by putting all the logic in stored procedure (all filtering). Trying not avoid putting the global filtering in the report itself.

Linking an EventID subreport parm to a formula field in main report (that is set to a constant), to force EventID value for subreport WITHOUT prompting user. We definitely don't want to prompt user because each subreport has a different forced EventID value, and can't just set a single value in main report.

When you link subreports using regular parm (subreport) to parm (main report) linkage, the subreport shows up just fine. I also need to display a Shared Variable that I set up in subreport in the main report. I have it working when I link subreport using regular parm-to-parm linkage.

But, as soon as I change linkage to parm-to-formula (parm in subrpt, formula field/constant in main)... which was Crystal's actual suggestion on how to force parm values without prompting users in their Knowledge Base... the subreport shows nothing. It appears blank, and you have to double click on the blank box to get into the subreport. Therefore, it also does NOT RETURN any useful information, including the shared variable back to main report.

Do you know how to utilize this PARM-TO-FORMULA technique (parm in subreport, formula in main) or another method of forcing parm values, AND make the subreport APPEAR to the main report so it recognizes shared variables, etc?

Please help. THANKS SO MUCH!

 
Please start a new thread, and when you do, also specify the datatypes of the parm/formula fields you are trying to link on.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top