Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Groups - NOT NESTED
Message
From
01/12/1998 02:14:37
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
01/12/1998 01:58:35
Ian Matthews
Up & Running Technologies Inc
Chestermere, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00162590
Message ID:
00162679
Views:
24
>Thanks Cetin for the late night response.
>
>I have two problems with this:
>1: the SELECT - SQL which I will think about later when I am more awake, and;
>2: the childrens data can not be listed on the same row it must be:
>Parent rec1 info (and only record)
>
>TITLES
>child1 rec1 info
>child1 rec2 info
>child1 rec3 info
>
>TITLES
>child2 rec1 info
>child2 rec2 info
>
>Thoughts???
>
Ian,
Being frankly I wouldn't do it with SQL. Create a cursor and populate it. If on the same row ie:
use t1
nFields1 = afields(aT1)
for ix = 1 to nFields1
	aT1[ix,1] = "a_"+aT1[ix,1]
endfor
select 0
use t2 order tag key
nFields2 = afields(aT2)
for ix = 1 to nFields2
	aT2[ix,1] = "b_"+aT2[ix,1]
endfor
select 0
use t3 order tag key
nFields3 = afields(aT3)
for ix = 1 to nFields2
	aT3[ix,1] = "c_"+aT3[ix,1]
endfor
dimension aStruc(nFields1+nFields2+nFields3,alen(aT1,2))
acopy(aT1,aStruc)
acopy(aT2,aStruc,1,-1,nFields1*alen(aT1,2)+1)
acopy(aT3,aStruc,1,-1,(nFields1+nFields2)*alen(aT1,2)+1)
create cursor mycursor from array aStruc
select t1
set relation to key into t2, key into t3
set skip to t2,t3
scan
	for ix = 1 to fcount()
		store eval(field(ix)) to ("m.a_"+field(ix))
	endfor
	select t2
	for ix = 1 to fcount()
		store eval(field(ix)) to ("m.b_"+field(ix))
	endfor
	select t3
	for ix = 1 to fcount()
		store eval(field(ix)) to ("m.c_"+field(ix))
	endfor
	insert into mycursor from  memvar
	select t1
endscan
select mycursor
brow
If not on the same row then things are easier, set skip is not used, in the main scan two other scans for childs are done.
Final cursor has all the fields from 3 tables preceded as a_, b_, c_. So I think it would be easy to put them on a report.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform