Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create cursor, where no fields is dynamic
Message
From
19/08/2000 02:01:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
18/08/2000 12:16:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00406720
Message ID:
00406981
Views:
40
>Is it possible to create a cursor with a variable number of fields, i.e. cursor has 3 constant fields,
>a,b,c, and fields f1 to fn where "n" is determinted when program is run?


Although generally what I prefer is Trey's 2nd option here is 3rd and 4th ways (there are others too) that sometimes needed :
-Create a structure array
-Create cursor from array
Example :
lnNeededCols = 20
dimension myArray[lnNeededCols+3,4]
myArray[1,1] = 'FieldA'
myArray[1,2] = 'C'
myArray[1,3] = 10
myArray[1,4] = 0
myArray[2,1] = 'FieldB'
myArray[2,2] = 'D'
myArray[2,3] = 8
myArray[2,4] = 0
myArray[3,1] = 'FieldC'
myArray[3,2] = 'L'
myArray[3,3] = 1
myArray[3,4] = 0
for ix = 4 to lnNeededCols+3
 myArray[ix,1] = 'Field'+padl(ix,2,'0')
 myArray[ix,2] = 'I'
 myArray[ix,3] = 4
 myArray[ix,4] = 0
endfor
create cursor myCursor from array myArray
-Get SQL generated cursor's structure into array and create from array
select .... from ... into cursor myCursor
afields(aStruc)
create my2ndCursor from array aStruc
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