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

How to show minimum no. of records in detail section

Status
Not open for further replies.

yog2go

Programmer
Jul 22, 2004
18
US

I have a purchase order report. I want set minimum no. of records to display in detail section even if the records doesn't exist.

For example, Set the limit to display 15 records.
Some purchase order might have 15 items. Then it will display all 15 items.

if some purchase orders doesn't have 15 items, but only has 5 items, then for others it should display 10 empty lines after those 5 items.

If some purchase orders has more than 15 lines then detail section should strech out to dispaly all records.

How can i do this?

Thanks in advance.
 
You'll need to count the rows in the details.

I'll assume that you're grouped by PO, and that you have a reasonably recent version of Crystal, not supplying at least your software version often wastes time:

Group Header Formula:
whileprintingrecords;
Numbervar LineCnt:=0

Details Formula:
whileprintingrecords;
Numbervar LineCnt:=LineCnt+1

Group Footer Formula:
whileprintingrecords;
Numbervar LineCnt;
stringvar AddLines:="";
If LineCnt < 15 then
AddLines:=ReplicateString(chr(13),15-LineCnt);
AddLines

The group footer formula will create the additional lines up to 15.

-k
 
I am using .net version of Crystal Report that comes with visual studio.net.

I created 3 formulas for groupheader, groupfooter and details section. Then i dragged this formulas in to their respective sections.

Then i ran PO report but it doesn't add those extra lines.

Thanks.

 
You have to format the group footer formula to "Can Grow". Right click on it->format field->common->can grow.

-LB
 
I set up that property but it still doesn't seem to be working.
 
If the issue is that you want to see repeated lines, not empty space representing the equivalent of 15 rows total for the group, then instead of this method, insert a group header_b and stretch it to the height of 15 rows. Insert a line and then copy and paste it repeatedly throughout the group header_b. Then go to the section expert and format the group header_b to "Underlay following sections."

To accommodate groups that have more than 15 rows, also insert a line in a detail_b section near the top, and then resize the section so that it is very narrow. Then create a running total {#cntwingrp} using the expert that counts a recurring field, evaluates for each record and resets on change of group. Then go to the section expert->detail_b->suppress->x+2 and enter:

{#cntwingrp} < 16

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top