Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Cursors in Grid
Message
From
06/09/2000 10:43:00
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/09/2000 16:06:38
Peter Lee
Lee Gray International
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00412627
Message ID:
00412938
Views:
12
>I seem to having a great deal of trouble incorporating information from related cursors into a single grid. A single cursor works fine, but setting a relationship between two, results in a blank grid. Do the cursors have to be active when creating the Grid in the form.
>any ideas
>
>Thanks
>
>Ps I am using cursors from local views,


Peter,
Grids work with multipl cursors and don't have problems with relations. ie:
CREATE cursor t1 (t1id i,t1field c(10))
CREATE cursor t2 (t1id i,t2id i, t2field c(12))
INDEX on t1id tag t1link
CREATE cursor t3 (t2id i,t3id i, t3field c(12))
INDEX on t2id tag t2link
CREATE cursor t4 (t1id i,t4field c(10))
INDEX on t1id tag t1link
FOR ix = 1 to 20
  INSERT into t1 values (ix, "T1_"+padl(ix,3,'0'))
  FOR jx = 1 to 5
    INSERT into t2 values (t1.t1id, reccount('t2')+1, ;
      "T1_"+padl(t1.t1id,2,'0')+'  T2_'+padl(jx,2,'0'))
    INSERT into t4 values (t1.t1id, "T1_"+padl(t1.t1id,2,'0')+'  T4_'+padl(jx,2,'0'))
    FOR kx = 1 to 5
      INSERT into t3 values (t2.t2id, reccount('t3')+1, ;
        "T2_"+padl(t2.t2id,2,'0')+'  T3_'+padl(kx,2,'0'))
    ENDFOR
  ENDFOR
ENDFOR
SELECT t2
SET relation to t2id into t3
SELECT t1
GO top
SET relation to t1id into t2, t1id into t4
SET skip to t2,t3,t4
oForm = createobject('Form')
WITH oForm
  .Addobject('myGrid','Grid')
  .Width=450
  WITH .MyGrid
    .Columncount=-1
    .Recordsource = 't1'
    .Columncount=4
    .Columns(1).ControlSource = 't1.t1field'
    .Columns(1).Header1.Caption = 't1field'
    .Columns(2).ControlSource = 't2.t2field'
    .Columns(2).Header1.Caption = 't2field'
    .Columns(3).ControlSource = 't3.t3field'
    .Columns(3).Header1.Caption = 't3field'
    .Columns(4).ControlSource = 't4.t4field'
    .Columns(4).Header1.Caption = 't4field'
    .Setall('Width',100,'Column')
    .Width = 450
    .visible = .t.
  ENDWITH
  .Show()
ENDWITH
READ events
OTOH grids are sensitive about finding its recordsource on init, having valid expressions and especially with SQL cursors needed indexes should exist.
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
Reply
Map
View

Click here to load this message in the networking platform