Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Loop through a cursor structure and gain knowledge
Message
From
28/04/2006 18:39:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/04/2006 18:08:21
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01117699
Message ID:
01117714
Views:
12
>>>Want something like GetCursorProp for cursors. I know, but it only works on views. As much as I can tell anyway. I need to loop through the cursor structure and capture things like the field names, size, type, etc. Do I have to put this into an array first?
>>
>>Ok, maybe AFIELDS is what I want to use, but how can I recreate the cursor in a non-clunky way from the array?
>
>Now I've got this:
>
>
>m.FieldCount = AFIELDS(aCursorProperties,'AcctValTest')
>
>FOR i = 1 TO m.FieldCount
>	? 'Name: ' + aCursorProperties(i,1)
>	? 'Type: ' + aCursorProperties(i,2)
>	? 'Width: ' + ALLTRIM(STR(aCursorProperties(i,3)))
>	? 'Decimals: ' + ALLTRIM(STR(aCursorProperties(i,4)))
>ENDFOR
>
>
>Which is nice, but it seems like the next step is going to involve a lot of concantenation and parsing. Is there a better way?

Jay,
You can create cursor from array but since you used afields(), first copy that array's 1-4 columns to another array (otherwise it carries properties from its derived table such as triggers).
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