Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Create PRG from Cursors or Tables
Message
 
 
À
12/07/2007 09:01:08
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01239561
Message ID:
01239635
Vues:
66
This message has been marked as the solution to the initial question of the thread.
>Doesn't matter as I did it manually. I didn't see anything that was incredibly useful in that thread for what I wanted to do. The solution (starred) was about creating a database of the list stru, which was nice, but not for what I was trying to do. I appreciate your help, but it's ok if I didn't find that thread very beneficial. Isn't it?

Actually, you're right. It would be too much tweaking to turn the code in this thread into what you wanted to do. Was tired last night.

I guess it would be easier to just use my own simple little procedure:
********************************************************************
*  Description.......: FieldsToString - creates a string with fields in a table
*  Calling Samples...:
*  Parameter List....: tlAddTypes, tlAddAlias, tlLower
*  Created by........: Nadya Nosonovsky 04/21/2005
*  Modified by.......: *-- CHANGE - NN - August 10, 2005 - 15:10:45
********************************************************************
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,PROPER(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)
This one doesn't include indexes and doesn't have NULLs, so needs a bit more changes. I'm lazy to change it, though.

You can call it in command window like
?FieldsToString(.t.) and it places the simple table structure (without some extra features) into clipboard.

Actually, good point. I guess, I need to go ahead and make some amends.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform