>>
>>TEXT TO m.strShape TEXTMERGE PRETEXT 8
>>shape append
>> new adChar(10) as Region,
>> new adInteger as RegionID,
>> ((shape append
>> new adChar(20) as Series,
>> new adInteger as RegionID )
>> as ls relate regionID to RegionID)
>>ENDTEXT
>
>
>thanx
>
>Can you highlight more ?
>How can i do the above without using shape ?
>
>m.ors1 = createobject("adodb.recordset")
>m.ors1.fields.append("region",adchar,10)
>m.ors1.fields.append("regionid",adinteger)
>
>now how to add the series recordset and relate?
>
>suhashegde
If you're doing hierarchical (that's if you need +/- for bands. bands property is readonly) AFAIK you can't do w/o "MSDataShape". However MSDataShape can fabricate recordsets (as shown in code), bind to VFP data (or any other OLEDB), or to XML.
In code check how it adds series recordet as 'child' to 'ls' relation.
Here is some code doing that with tables (direct table is commented):
TESTDATALOC = _samples+"data\testdata.DBC"
PUBLIC oForm
oForm = createobject('myForm')
oForm.Show
Define CLASS myform AS form
Top = 0
Left = 0
Height = 450
Width = 750
DoCreate = .T.
Caption = "Form1"
Name = "Form1"
Add OBJECT hflex AS olecontrol WITH ;
Top = 0, ;
Left = 0, ;
Height = 420, ;
Width = 750, ;
Name = "Hflex", ;
OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'
Procedure Init
Local oRecordset,oConnection, strCn, strShp
strCn = [Provider=MSDataShape;Persist Security Info=False;]+;
[Data Source=]+TESTDATALOC+[;Data Provider=VFPOLEDB]
strShp = [SHAPE {select Company,Cust_id from customer} as Customers ]+;
[ APPEND ( {select cust_id,order_date,order_id from orders} RELATE cust_id TO cust_id ) ]
oRecordset = CreateObject("adodb.recordset")
oConnection = CreateObject("adodb.connection")
With oConnection
.Provider = "MSDataShape"
.ConnectionString = strCn
.Open
Endwith
With oRecordset
.ActiveConnection = oConnection
.Source = strShp
.Open
Endwith
With this.hflex
.Datasource = oRecordset
.GridColorBand(0) = rgb(255,0,0)
.GridColorBand(1) = rgb(0,0,255)
.Cols(0) = 2
.ColWidth(0,0) = 16*15
.ColWidth(1,0) = 250*15
.CollapseAll
Endwith
Endproc
Enddefine
Cetin