|
You can do it by using a shared variable as a counter and a formula that defines an interval of N records (20 in your case). Then you can group on this formula and modify the group in order to show a group name like "1 - 20", "21- 40", and so on. You can insert a summary to get the sum, average, etc. on each group. Follow these steps:
- Create a formula named "IntervalNumber". Use this code (CR syntax):
Global NumberVar Counter;
Local NumberVar Result;
Result := 1 + ((Counter )\20) + {Table.NumericField} * 0;
Counter := Counter + 1;
Result
Replace {Table.NumericField} by any numeric field in your table. This field is necessary to avoid an error when previewing the report.
- Create a group based on the @IntervalNumber formula. Change Group Options; select "Use formula as Group Name", click the "x+2" icon beside this option and type this code in the formula editor:
NumberVar Value2 := CDbl({@IntervalNumber}) * 20;
NumberVar Value1 := Value2 - 20 + 1;
ToText(CDbl(Value1) , 0, "") & " - " & ToText(Value2, 0, "")
This code shows the group name as "1 - 20", "21 - 40", etc.
If you use a parameter instead of the fixed value 20, you can get custom intervals of N records, being N the parameter value.
I'm not sure but I think this should work for any report.
|