on 09-17-2008 6:40 PM
Ok. I keep running into road blocks THANKS FOR THIS FORUM!!!
here is the latest.
I am trying to pass this total to a subreport for evaluation in a chart.
have this formula in the year grouping on the main report.
whileprintingrecords;
numbervar escalation;
//2007 Deescalation
if {TPHASE.DF_DATE}= #1/31/2006 12:00AM# or
{TPHASE.DF_DATE}= #2/28/2007 12:00AM# or
{TPHASE.DF_DATE}= #3/31/2007 12:00AM# or
{TPHASE.DF_DATE}= #4/30/2007 12:00AM# or
{TPHASE.DF_DATE}= #5/31/2007 12:00AM# or
{TPHASE.DF_DATE}= #6/30/2007 12:00AM# or
{TPHASE.DF_DATE}= #7/31/2007 12:00AM# or
{TPHASE.DF_DATE}= #8/31/2007 12:00AM# or
{TPHASE.DF_DATE}= #9/30/2007 12:00AM# or
{TPHASE.DF_DATE}= #10/31/2007 12:00AM# or
{TPHASE.DF_DATE}= #11/30/2007 12:00AM# or
{TPHASE.DF_DATE}= #12/31/2007 12:00AM# then
escalation:=({#Active Projects}/1.035)
//2008 Deescalation
Else
If {TPHASE.DF_DATE}= #1/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #2/28/2008 12:00AM# or
{TPHASE.DF_DATE}= #3/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #4/30/2008 12:00AM# or
{TPHASE.DF_DATE}= #5/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #6/30/2008 12:00AM# or
{TPHASE.DF_DATE}= #7/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #8/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #9/30/2008 12:00AM# or
{TPHASE.DF_DATE}= #10/31/2008 12:00AM# or
{TPHASE.DF_DATE}= #11/30/2008 12:00AM# or
{TPHASE.DF_DATE}= #12/31/2008 12:00AM# then
escalation:=({#Active Projects}/1.071)
//2009 Deescalation
else
If {TPHASE.DF_DATE}>= #1/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #2/28/2009 12:00AM# or
{TPHASE.DF_DATE}>= #3/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #4/30/2009 12:00AM# or
{TPHASE.DF_DATE}>= #5/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #6/30/2009 12:00AM# or
{TPHASE.DF_DATE}>= #7/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #8/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #9/30/2009 12:00AM# or
{TPHASE.DF_DATE}>= #10/31/2009 12:00AM# or
{TPHASE.DF_DATE}>= #11/30/2009 12:00AM# or
{TPHASE.DF_DATE}>= #12/31/2009 12:00AM# then
escalation:=({#Active Projects}/1.108)
else {#Active Projects};
In the subreport I have this in the formula to chart
whileprintingrecords;
tonumber ({?Pm-@ActProj})
I am not getting any totals in the sub report
does any one have any I deas to accomplish this?
The chart in the subreport does not show the formula if I use the proposed solution. Any one have an idea as to why?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John,
I am assuming you would like to gather the values on the main report and then chart on all those values in the subreport.
If it's the case, I will suggest to read the following document:
[Charting on WhilePrintingRecords formula|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40e7130d-aa1e-2b10-ce9f-eee2a54ff4cd]
It contains a step by step instructions on how to chart whileprintingrecords formula.
I actualy did follow that white paper and there is where I am falling short. I cannot figure out why the value in the formula in the main report will not pass to the subreport.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I cannot find a c2007600 note. I dont think it is there any longer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John,
I have copied the note here
How can you share subreport data with the main report in version 7 (or higher) of the Crystal Reports Designer?
Resolution
Shared variables, introduced in Crystal Reports version 7, make it easier to pass values from a subreport to the main report. Using shared variables requires two formulas: one to store the value in a shared variable, the other to retrieve the value from the shared variable.
The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored before evaluating the formula that retrieves the shared variable.
For example if you want to pass a grand total from the subreport to do a calculation in the main report, follow these steps:
1. In the subreport, create a formula similar to the one below:
//@SubFormula
//Stores the grand total of the
//{Orders.Order Amount} field
//in a currency variable called 'myTotal'
WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})
2. Place this formula in your subreport.
3. In the main report, create a formula that declares the same variable name:
//@MainFormula
//Returns the value that was stored
//in the shared currency variable called
//myTotal in the subreport
WhilePrintingRecords;
Shared CurrencyVar myTotal;
myTotal
4. Place @MainFormula in a main report section that is beneath the section containing the subreport.
NOTE:======
For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula.
One way to do this is to insert a section below the section containing the subreport, and place @MainFormula in this new sub-section:
· On the 'Format' menu, click 'Section'.
· On the 'Sections' list, click the section containing the subreport.
· Click 'Insert' (at top of dialog box). This inserts an additional subsection.
· Click 'OK' to return to the report, and insert @MainFormula into this new sub-section.
The next time you preview the report, @MainFormula displays the value from the subreport. In this particular example, that value was the grand total of the {Orders.Order Amount} field.
============
5. Once you have verified that @MainFormula is returning the correct value from the subreport, you can include this formula in other main report formulas, such as:
//@NewFormula
//includes data from subreport
{@MainFormula}+ Sum ({Customer.Last Year's Sales})
· Place this formula in the same section as @MainFormula, or in a section further down on the report.
You have now successfully shared data from a subreport with the main report.
NOTE: =====
This is not possible with On Demand Subreports in Crystal Reports.
==========
Hope that helps!!
Regards,
Shweta
This formula must be in a section ABOVE the chart you want to pass it to.
Shared Numbervar numParam := tonumber ({?Pm-@ActProj})
Declare this again, anywhere in the report, or sub report BELOW
where it was originally declared, and you can see it.
Hope this helps,
The Panda
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to pass info from subreports to main report or main reports to subreports go to Business Objects Notes (see the link on the left side of this page) and search for:
c2007600
"How to Share Subreport data with Main Report"
(works vice versa as well)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.