Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Get field names that in an index key expression
Message
De
02/06/2005 00:42:46
 
 
À
01/06/2005 15:20:02
Kay Alexander
Pennsylvania Farm Bureau
Pennsylvanie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01019098
Message ID:
01019237
Vues:
29
>Hi,
>I created a .CDX file. The key expression contains multi fields as "cField1+STR(nField2)+...". Now, I am trying to recall those fields in the index one by one to create a cursor programmatically. I realize that I can get a string of the key expression with SYS(14) or KEY() function, but I need to extract a field name logically. Is there a function that I can use to accomplish this task without programming whole bunch of codes?
>Thank you in advance.
>
>Kay

Kay,

I'm quite happy with this. It's not perfect
&& table must be open
function FieldListFromExpression( s, TableAlias )
	local i, n, out, expArray[1]

	TableAlias = iif(!empty(m.TableAlias), m.TableAlias, select(0))
	
	#define sep	[!@#$%^&*()-+=></,"] + '[]'
	for i = 1 to len(sep)
		s = strtran(m.s, substr(sep, m.i,1), NL)
	endfor
	#undefine sep
	
	n = alines(expArray, m.s, TRUE )
		
	Out = ''
	for i = 1 to n
	
		do case
		case empty(expArray[m.i])
		
		case empty(fsize(expArray[m.i], m.TableAlias))
		
		case !empty(m.out)
			Out = m.out + ',' + expArray[m.i]
		
		otherwise
			Out = expArray[m.i]
		
		endcase
	endfor
	return Out
	
*---------------------------------------------------------------------------
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform