I need to redesign a report so that it does not use variables. The need for removing variables is because I must insert a chart, where the layout of the chart shows the numbers from a formula containing variables. Crystal Reports does not allow the chart layout to show formulas that contain variables. This is an assumption based on my understanding of charts & variables – if someone knows how to show variables in charts, then please let me know how, and the rest of this thread is irrelevant.
I use variables because I need to round and display numbers to the nearest 1000, in two different Group Footers. The round and display to the nearest 1000 is not required at the Detail level.
The database field that needs to be rounded and displayed to the nearest 1000 is called Budget. The two group fields are Division and Branch.
In Group Footer #2 I display the following formula to give me the first amount rounded to nearest 1000:
@BudgetBranch
whileprintingrecords;
numbervar BudgetBranch := round((Sum ({Budget}, {Branch}) / 1000),0);
To display the sum of this BudgetBranch in Group Footer #1 I use the technique of initialising, calculating and then displaying a variable. That is, in Group Header #1 I initialise a variable using the following formula:
@BudgetDivisionInit
whileprintingrecords;
numbervar BudgetDivision := 0
In Group Footer #2 I calculate the variable:
@BudgetDivisionCalc
whileprintingrecords;
numbervar BudgetBranch;
numbervar BudgetDivision := BudgetDivision + BudgetBranch
Finally in Group Footer #1 I display the variable to give me the second amount rounded to nearest 1000:
@BudgetDivisionDisp
whileprintingrecords;
numbervar BudgetDivision
All of this works fine. But now, in Group Footer #1 I want a Chart that shows the value of @BudgetDivisionDisp in the layout. However this formula field is not available as an option to show in the chart layout. I have assumed that it is not available because it contains a variable. So, my question is “how can I round & display amounts to nearest 1000 without using Variables?”
Note I do not perform the division by 1000 and rounding in a formula at the Detail level, and then just use the Sum function in Group Footer, because this does give incorrect rounding results at the Group Footer levels.
Thanking you in advance.
I use variables because I need to round and display numbers to the nearest 1000, in two different Group Footers. The round and display to the nearest 1000 is not required at the Detail level.
The database field that needs to be rounded and displayed to the nearest 1000 is called Budget. The two group fields are Division and Branch.
In Group Footer #2 I display the following formula to give me the first amount rounded to nearest 1000:
@BudgetBranch
whileprintingrecords;
numbervar BudgetBranch := round((Sum ({Budget}, {Branch}) / 1000),0);
To display the sum of this BudgetBranch in Group Footer #1 I use the technique of initialising, calculating and then displaying a variable. That is, in Group Header #1 I initialise a variable using the following formula:
@BudgetDivisionInit
whileprintingrecords;
numbervar BudgetDivision := 0
In Group Footer #2 I calculate the variable:
@BudgetDivisionCalc
whileprintingrecords;
numbervar BudgetBranch;
numbervar BudgetDivision := BudgetDivision + BudgetBranch
Finally in Group Footer #1 I display the variable to give me the second amount rounded to nearest 1000:
@BudgetDivisionDisp
whileprintingrecords;
numbervar BudgetDivision
All of this works fine. But now, in Group Footer #1 I want a Chart that shows the value of @BudgetDivisionDisp in the layout. However this formula field is not available as an option to show in the chart layout. I have assumed that it is not available because it contains a variable. So, my question is “how can I round & display amounts to nearest 1000 without using Variables?”
Note I do not perform the division by 1000 and rounding in a formula at the Detail level, and then just use the Sum function in Group Footer, because this does give incorrect rounding results at the Group Footer levels.
Thanking you in advance.