Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generate TABLE from Code
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01232619
Message ID:
01232625
Views:
16
>Hey Gang!
>
>I have a table called DW_HEADER.
>
>I want to create a text file (.PRG) so that when I run it in VFP, it creates the TABLE.
>
>So.................
>
>Any tools that can READ the already created table, and create the text file, with the commands in it, to CREATE the table later from the master program? (And no, there is no database container for this project... sigh.)
>
>Thanks!

For the free table you may take the first step using something simple as
FUNCTION FieldsToString
LPARAMETERS tlAddTypes, tlAddAlias, tlLower

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

FOR lni = 1 TO m.lnFields
	lcType = laFields[m.lnI,2]
	IF m.tlLower
	  lcField = LOWER(laFields[m.lnI,1])
	ELSE
	   lcField = LOWER(LEFT(laFields[m.lnI, 1],1)) + ;
		PROPER(SUBSTR(laFields[m.lnI, 1],2)) 
	ENDIF
	
	lcStr = m.lcStr + ", " + IIF(m.tlAddAlias,ALIAS() + ".", "") + ;
	    m.lcField + ;	
		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 = SUBSTR(m.lcStr, 3)
output to file instead of cliptext and add index generation routine.

For Database you may look at GenDBC program, which ships with VFP.
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