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

Many related tables in Report 2

Status
Not open for further replies.

parslej

Programmer
Nov 21, 2001
40
PL
I try many times show in Report more than 1 tables (in telation with other) but I don't know how! I read that I should use grouping - I'll do it but still I have stupid data in preview...

Ok, I have something like:

table-1 table-2

ID
1. .... +- 1.1. .....
|- 1.2. .....
|- 1.3. .....
+- 1.4. .....

2. .... + 2.1. .....

3. .... +- 3.1. .....
|- 3.2. .....
|- 3.3. .....
+- 3.4. .....



I want show report:

1 ............
1.1. .....
1.2. .....
1.3. .....
1.4. .....

2. ....
2.1. .....

3. ....
3.1. .....
3.2. .....

etc

Any1 know ?

(And what happend If we add table_3, table_4...)


if you have any examples please, please send me via e-mail: m.pietruszka@lubaczow.pl
 
HI
The easyway...

** 1.Create a myCursor for report generation
SELECT A.field1, a.field2, a.field3.... ;
b.field1, b.field2, b.field3.... ;
FROM myTableA A, myTableB B INTO CURSOR myCursor ;
WHERE a.field1 = b.field1 ..... ;
ORDER BY a.field1.....

** 2.Crate the report with
a. Grouping on a.field1 which is the key field..
b. In your Group header or header ... add all fields related to a.field1, a.field2 etc
c. In detail band... add all fields related to b.field2, b.field3 etc.
In the report format, a. b. etc alias shall not be added, since myCursor is the default table and all the fields are available in this cursor.

The report shall produce the result as you ask for.

Now if more than one table is involved, the myCursor follows the same trategy of pulling all information into one cursor.

Hope this helps you :)

ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
In order to create reports in which relationships are involved you have to understand 1 overriding concept.

The report form will only move through 1 table (record by record) during the entire report process. The report form process WILL NOT switch to a different table (without some off the wall manipulations which you don't want to get into). So you have to provide it with that table. All of the other tables you have involved will only move to a different record number if they are related to that main table in some way. And then you only have access to the data in that single record they have moved to.

For example, invoices ... you have an invoice header table and an invoice detail table. You sort the detail by invoice number and make that your main report form table. You also set relation to INVOICENO into invoice header table. That way when the INVOICENO of the detail table changes to a different INVOICENO, the record number of the invoice header table moves to the record with the INVOICENO.

Then you have access to the information in the header record for that invoice as you are moving through each detail record of the invoice.

Now you can also use SQL commands of whatever else you know to put ALL OF THE DATA into 1 gigantic table (very redundant but it works for reporting). I will not get into all of that but it sometimes is the best solution.

Good luck.


Don
dond@csrinc.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top