Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating cursors with fieldnames in an array
Message
 
To
25/09/2000 23:33:04
Jordan Pastourel
Worksafe Management Systems
Toowong, Australia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00420748
Message ID:
00420750
Views:
21
>Hi All,
>i am trying to create a new cursor with fieldnames located in a dynamic array. the code i use is as follows:
>
>create cursor gracur(&alabels[1] N(10))
>if alen(alabels) > 1
> for i=2 to alen(alabels)
> newcolm = str(alabels[i])
> alter table gracur add column &newcolm N(10)
> endfor
>endif
>select gracur
>append from array agraph
>
>every time i run this it gives me a syntax error on the first line. if this is not the way to do it, how can i go about setting up this cursor??
>please help!!!!
>
>Jordan

If all else fails create a variable holding the commands eg
fink = "create cursor gracur( " + alabels[1] +" N(10))" and build it up.
&fink
fink = "alter table gracur add column " + alabels[i] + " N(10))
&fink
the other problem might be the &newcolm, does it want (newcolm)

why do you str(alabels[i]), it should be a string already. Is that the problem?

HTH
Sarah
Sarah King
pcpropertymanager.com
Previous
Reply
Map
View

Click here to load this message in the networking platform