if file('parent_table.dbf') // drop table parent_table endif if not file('parent_table.dbf') create table parent_table (id autoinc,code character(15),name character(15)) insert into parent_table (code,name) values ("1","James") insert into parent_table (code,name) values ("2","John") insert into parent_table (code,name) values ("3","Paul") endif if file('child_table.dbf') // drop table child_table endif if not file('child_table.dbf') create table child_table (trans_no autoinc,item character(15),child_table.'date' date,; qty numeric(10,2),amount numeric(10,2)) insert into child_table (item,child_table.'date',qty,amount) values ("1",'06/21/2017',4.00,23.00) insert into child_table (item,child_table.'date',qty,amount) values ("2",'06/21/2017',5.00,19.00) insert into child_table (item,child_table.'date',qty,amount) values ("3",'06/21/2017',2.00,21.00) insert into child_table (item,child_table.'date',qty,amount) values ("1",'06/21/2017',3.00,11.00) insert into child_table (item,child_table.'date',qty,amount) values ("2",'06/21/2017',5.00,22.00) insert into child_table (item,child_table.'date',qty,amount) values ("3",'06/21/2017',1.00,31.00) use child_table exclusive index on item tag item use endif ** END HEADER -- do not remove this line // // Generated on 2017-06-21 // parameter bModal local f f = new parent_childForm() if (bModal) f.mdi = false // ensure not MDI f.readModal() else f.open() endif class parent_childForm of FORM with (this) height = 30.0455 left = -2.8571 top = -0.8182 width = 131.7143 text = "" endwith this.PARENT_TABLE2 = new QUERY(this) with (this.PARENT_TABLE2) left = 32.0 top = 1.0 width = 10.0 height = 1.0 sql = 'select p.code,p.name,c.trans_no,c."date",c.qty,c.amount from parent_table p inner join child_table c on p.code = c.item' active = true endwith this.PARENT_TABLE1 = new QUERY(this) with (this.PARENT_TABLE1) left = 4.0 top = 1.0 width = 10.0 height = 1.0 sql = 'select * from "parent_table.DBF"' active = true endwith this.CHILD_TABLE1 = new QUERY(this) with (this.CHILD_TABLE1) left = 21.0 top = 1.0 width = 9.0 height = 1.0 sql = 'select * from "child_table.DBF"' active = true endwith with (this.CHILD_TABLE1.rowset) indexName = "ITEM" masterRowset = form.parent_table1.rowset masterFields = "code" endwith this.GRID1 = new GRID(this) with (this.GRID1) dataLink = form.parent_table1.rowset height = 4.5 left = 7.0 top = 3.5 width = 65.0 endwith this.GRID2 = new GRID(this) with (this.GRID2) dataLink = form.child_table1.rowset height = 6.0 left = 7.0 top = 10.0 width = 92.0 endwith this.GRID3 = new GRID(this) with (this.GRID3) dataLink = form.parent_table2.rowset height = 8.0 left = 7.0 top = 19.0 width = 118.0 endwith this.rowset = this.child_table1.rowset endclass