When you create the formula, you want to have as many groups as your total number of checks divided by 3. You can make the formula have more groups (they won't be populated), but not less--so you don't need to know the exact number. If there are less, you will have a large last group.
I tried using a formula that uses a loop instead of the hard coded group numbers in the {@grp} formula:
numbervar counter;
numbervar result;
for counter := 1 to 29 do (
if col in (3 * counter) - 2 to (3 * counter) then
result := counter;
result;
This still requires a hard value for the maximum number of groups (here 29), but when linking the subreport to the main report on this revised formula, the loop itself seemed to cause some geometric increase in the string accumulation which resulted in the "string is more than 254 characters" error. This error doesn't occur (at least for relatively small numbers of checks in 8.0 when I use the hard coded group range values. It probably wouldn't be a problem in 9.0. So, I think hard values must be used in this instance.
In order to simply generate a formula that might be very long, create a separate report in which you create a formula:
"if col in "+ totext(3*recordnumber-2,0,"")+" to "+totext(3*recordnumber,0,"") +" then "+totext(recordnumber,0,"")+" else"
Place this in the detail section. Then export the report to a word file. You can then copy the results and paste it into your formula, just adding the final number after the last "else". That makes using the hard numbers less onerous.
So your formula should look like:
numbervar col;
stringvar x;
if instr(x,{table.chkno}) = 0 then
(x := x + {table.chkno})+", ";
col := col + 1);
if col in 1 to 3 then 1 else //this line and the following ones can
//be generated in a separate report and plugged in here
if col in 4 to 6 then 2 else
if col in 7 to 9 then 3 else
if col in 10 to 12 then 4;
This doesn't solve the problem of the 254 character limit for strings, and I don't know whether this applies to CR.net. I'd be interested in knowing.
-LB