Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get field names that in an index key expression
Message
From
02/06/2005 00:42:46
 
 
To
01/06/2005 15:20:02
Kay Alexander
Pennsylvania Farm Bureau
Pennsylvania, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01019098
Message ID:
01019237
Views:
28
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform