Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table definition for CREATE CURSOR
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01052394
Message ID:
01052455
Views:
7
Each function serves its purpose <g> In my case I wanted an ability to quickly put fields (and sometimes with types) in a clipboard. So, when I'm working on some code which requires select statement, for example, I open my table, switch to command window, type fieldstostring() and then paste my fields into the program I'm working on. Of course, I can probably add it to my intellisense, but I'm a little bit lazy, though I did once attended a great presentation by Andy Kramek about using intellisense, I still haven't implemented all these ideas.

>Are those kind of function (yours and Dan's) necesary? The AFIELDS() is enougth to create the cursor, so I'm meaning there's no need to create a loop in the ARRAY list created by AFIELDS since the CREATE CURSOR has a FROM ARRAY clause.
>
>
>
>*  Program...........: CopyToCursor
>*  Author............: Esparta Palma
>*  Created...........: 09.23.2005  11:28 AM
>*  Copyright.........: (c) Freeware
>*) Description.......: Create a cursor bases on any table (or cursor) or
>*)                   : actual area if not used second parameter into the
>*)                   : desired cursor.
>*  Calling Samples...: m.TotalFields = CopyToCursor("cCustomer","Customer")
>*)                   : m.TotalFields = CopyToCursor("cCustomer")
>*  Parameter List....: tcCursor -> The name of the cursor to create
>*)                   : tcAlias  -> The source alias
>*  Returns...........: Any positive number if sucefull (the numbers of
>*)                   : created fields in the cursor)
>*)                   : Any negative number if error (the Error number)
>*  Major change list.:
>*--------------------------------------------------------------------------------------------------
>FUNCTION CopyToCursor
>LPARAMETERS tcCursor,tcAlias
>
>   LOCAL nRetValue
>
>   IF (VARTYPE(m.tcAlias) # 'C') OR (EMPTY(m.tcAlias))
>     m.tcAlias = ALIAS()
>   ENDIF
>
>   TRY
>     m.nRetValue = AFIELDS(laFields,m.tcAlias)
>     CREATE CURSOR (tcCursor) FROM ARRAY laFields
>   CATCH TO oError
>     m.nRetValue = oError.ErrorNo * -1
>   ENDTRY
>
>   RETURN m.nRetValue
>ENDFUNC
>
>
>HTH.
>>>Brenda,
>>>
>>>Take a look at MESSAGE# 1004694
>>>
>>>Hope this helps
>>>
>>>-Dan
>
>>Now I see I re-invented the wheel <g> It was not that hard, though <g>
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform