Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Merging vfp table structures
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01390885
Message ID:
01390886
Views:
82
>Hi all,
>I need to create an empty cursor from multiple table structures.
>I was about ready to create some code using afields, ascan and alter table
>But I sure this is simple a SQL ?
>
>Any help? thanks.

I use this simple program to get cursor (or table) structure into the clipboard
********************************************************************
*  Description.......: FieldsToString - creates a string with fields in a table
*  Calling Samples...:
*  Parameter List....: tlAddTypes, tlAddAlias
*  Created by........: Nadya Nosonovsky 04/21/2005
*  Modified by.......: *-- CHANGE - NN - August 10, 2005 - 15:10:45
********************************************************************
FUNCTION FieldsToString
LPARAMETERS tlAddTypes, tlAddAlias

LOCAL lcStr, lnI, lnFields, laFields[1], lcType
lnFields = AFIELDS(laFields)
lcStr = ""

FOR lnI = 1 TO m.lnFields
	lcType = laFields[m.lnI,2]
	lcStr = m.lcStr + ", ;" + CHR(13) + CHR(10) + CHR(9) + ;
		IIF(m.tlAddAlias,ALIAS() + ".", "") + ;
		LOWER(LEFT(laFields[m.lnI, 1],1)) + ;
		PROPER(SUBSTR(laFields[m.lnI, 1],2)) + ;
		IIF(m.tlAddTypes, " " + m.lcType + ;
		IIF(NOT INLIST(m.lcType, "D","T","I","G","M","Y"), "(" + TRANSFORM(laFields[m.lnI,3]) + ;
		IIF(laFields[m.lnI,4] > 0, ", " + TRANSFORM(laFields[m.lnI,4]),"") + ")",""),"")
NEXT
_CLIPTEXT = m.lcStr
So, just run this program multiple times (merge cliptext) to get all your cursors/tables into the clipboard and then just add the CREATE CURSOR at the beginning and add ( ).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform