
Untitled
By: a guest on
Jul 1st, 2012 | syntax:
None | size: 1.09 KB | hits: 16 | expires: Never
How to reference a previous group for year-on-year calculations in a Crystal Report?
2010
January £20,000
February £30,000
March £15,000
etc.
2011
January £16,000
February £14,000
2010
January
Company 1 £5,000
Company 2 £7,000
Company 3 £8,000
Global StringVar JanGlobal;
Local NumberVar NumberToCompare := 0;
If Year(Sales) = 2010 Then
JanGlobal := '||' + {CompanyName} + '|' + ToText({SalesFigure}); //append current value to Jan's formula
Else
(
If UBound(SalesSearch) > 0
(
Local NumberVar Searching := 1;
For Searching = 1 to UBound(SalesSearch)
If SalesSearch[Searching] StartsWith ({CompanyName} + '|') Then
(
Local StringVar Array Matched := Split(SalesSearch[Searching], '|')
NumberToCompare := ToNumber(Matched[2]);
)
Next
)
//do whatever you want with the 2011 sales figure and the value of NumberToCompare
//(which should be either zero or Jan 2010's sales figure for the company) here
)