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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting detail lines on sub report 1

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
US
I am working with four sub reports, pages 1, 2, 3 & 4 respectively. Each sub report is will contain 18 detail lines. The first subreport will contain detail lines 1-18 and the second will contain 19-36, etc. The subreports are in sequential report footers of the main report.
The subreports are for a travel document.

EXAMPLE of data returned from SQL Query:

# date destination meals Trans. misc.
1 3/1/06 Atlanta 50.00 300.00 10.00
2 3/2/06 Columbia 45.00 275.00

Only one expense can be printed per line. Therefore, the desired result is for line #1 to appear as 3 lines and line #2 should appear as 2 lines (total of 5 detail lines). I have accomplished this by creating detail lines a, b, & c (meals, Trans, misc.)and conditionally suppressing them.

EXAMPLE of conditional suppression of detail section a:

{Travel.meals}<=.00

This sort of works for the first Travel subreport. But how do I count the detail lines in order to limit the data returned on the first Travel subreport? I need to be able to count the individual detail lines in order to know when to generate the 2nd Travel subreport.

Normally, I would use Special Field RecordNumber to determine the amt of detail lines contained per page. However in this case that will not work. Crystal considers the three occurrences of line # 1 are one record (RecordNumber) and the two occurrences of line two are considered one record.

How can I make my subreport count each detail line and not just the RecordNumber?

My subreports are designed to contain 18 detail lines per page. However, currently I am returning 26 detail lines on my first page of my subreport.

Your assistance limiting the data returned per subreport/page and or determining actual number of detail per page is greatly appreciated.

Ingrid




 
You can count using variables, and pass them between the main and other subreports.

You description left a nit tothe imagination, so I'll just provide theory:

Subreport1 formula:

whileprintingrecords;
shared variable LineCount;
if <condition> then
LineCount:=LineCount+1

So the condition is whatever you're doing to display the lines, at the same level, whatever it is that qualifies as a line in your logic.

Then you can test oruse the variable afterwards:

shared variable LineCount;
if LineCount = 18 then
"last detail line"

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top