Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Want Summary Band at bottom of page.
Message
 
To
18/09/2008 16:19:46
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01345297
Message ID:
01348825
Views:
49
Hi Matt,

For the second detail band, you need two tables. The group header table must be the one that is entered as the detail table in the report band. This table is then linked with the line item table twice. That means you open line item twice with different aliases. In both cases you use SET RELATION TO to link the header table to the line item table. For the first instance of the line item table that you will use in the report, you also set SET SKIP TO.

If you create the relationship in VFP and open the SET window you should see the header table with lines going through the two item tables. One alias has a double line, the other one a single line. The code to set this up would be (replace with the actual table names):
USE header IN 0
USE lineitem IN 0 AGAIN ORDER idTag
USE lineitem IN 0 AGAIN ALIAS FirstRec ORDER idTag
SELECT header
SET RELATION TO idField INTO lineitem, idField INTO FirstRec
SET SKIP TO lineitem
The key is SET SKIP which makes VFP think that the header table has as many records as the line item tables. When you (or the report writer) skip through the table, the record pointer moves through all line item records. Only if there is no related line item SKIP will actually move the record in the parent table. Because SET SKIP is not set to the FirstRec table, VFP always locates the first line item for every header record.

With the data environment set up what you need in the report is a two line detail band. The first line is the header. All items have checked "Remove line if blank". As the "Print When" expression enter:
RECNO("lineitem") == RECNO("FirstRec")
This condition is only true for the first line item record which happens to be the time when you need to print the simulated group header. The second line is the actual detail line. No special settings for the second line are required. Just make sure that the first and the second line to not overlap or share any common objects such as vertical lines.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform