Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RECORD COUNT TO CONTINUE

Status
Not open for further replies.

wbj0711

MIS
Feb 9, 2012
2
US
Using Crystal Reports 11. I am running a report that counts the records on the detail line. I would like to continue the count even though there is no more data to display. The record count needs to go to 40. On each of the detail records there will be lines and text that need to be repeated for record.
Ex.
Rec# 1 WO# DATE ________ Tech
Rec# 2 WO# DATE ________ Tech
Rec# 3 (No more Data) ________ Tech
Rec# 4 (No more Data) ________ Tech



Any Help would be great.
 
The following assumes that you want do add the extra lines and the end of a group. Create these formulas:

//{@reset} to be placed in the group header:
whileprintingrecords;
numbervar cnt := 0;
stringvar x := "";

//{@addlines} to be placed in the detail section and used to return the record count:

whileprintingrecords;
numbervar cnt;
stringvar x;
numbervar i;
numbervar j := 40;
if not onlastrecord and
(
{table.groupfield} = next({table.groupfield}) or
count({table.groupfield},{table.groupfield}) >= j
) then (
cnt := cnt + 1;
x := totext(cnt,0,"")
);
if (
onlastrecord
or
{table.groupfield} <> next({table.groupfield})
) and
count({table.groupfield},{table.groupfield}) < j then (
cnt := cnt + 1;
(
for i := 1 to j-count({table.groupfield},{table.groupfield})+1 do(
x := x + chr(13)+totext(cnt,0,"")+'____________'+"Tech";
cnt := cnt + 1;
))
);
if instr(x,chr(13))<> 0 then
mid(x,instr(x,chr(13))+1) else
x;

Place this in the detail section and format it to "can grow". Also format it to "tight horizontal" on the border. Since the formula will replace the actual last detail record, whatever you place in the regular detail section needs to be built into the formula where the blank line +"tech" is, and then the regular detail fields need to be suppressed with a formula like this so they don't overlap on the last record:

onlastrecord or
{table.groupfield} <> next({table.groupfield})

-LB
 
Thanks for responding, but I will not be using groups.

Thanks
 
Were you able to adapt my solution? The same method will work, you just don't need the reset or the clauses that reference the groupfield. The count function also would need to have the group argument removed. So, it would look like:

whileprintingrecords;
numbervar cnt;
stringvar x;
numbervar i;
numbervar j := 40;
if not onlastrecord and
count({table.anynonnullfield}) >= j then (
cnt := cnt + 1;
x := totext(cnt,0,"")
);
if onlastrecord and
count({table.anynonnullfield}) < j then (
cnt := cnt + 1;
(
for i := 1 to j-count({table.anynonnullfield})+1 do(
x := x + chr(13)+totext(cnt,0,"")+'____________'+"Tech";
cnt := cnt + 1;
))
);
if instr(x,chr(13))<> 0 then
mid(x,instr(x,chr(13))+1) else
x;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top