networkthis
Programmer
I'm new to VFP and I'm trying to pull my table names into a loop and loop through them individually counting the matches per column based on user input..... Here is a simplified version of what I am trying to do... I think I have the basics set up for this, but I'm not quite sure that my variable is passing properly into my locate for ( )... if I simply type mydb.mytablename into: locate for (mydb.mytablename) it works great. However, if I try to pass my_var into it, it fails every time... :-/ Any ideas, or thoughts would be greatly appreciated!!!
LOCAL locate_name
**locate_name = table1.fname
STORE 0 TO gnCount
gnFieldcount = AFIELDS(gaMyArray)
CLEAR
FOR nCount = 1 TO gnFieldCount
?gaMyArray(nCount,1)
field_name = gaMyArray(nCount,1)
locate_name = ('table1.' + field_name)
?locate_name
LOCATE FOR (locate_name) = 'Ray'
DO WHILE FOUND( )
gnCount = gnCount +1
? " It matches: " + fname
CONTINUE
ENDDO
ENDFOR
? ' Total Matches: ' + ALLTRIM(STR(gnCount))
LOCAL locate_name
**locate_name = table1.fname
STORE 0 TO gnCount
gnFieldcount = AFIELDS(gaMyArray)
CLEAR
FOR nCount = 1 TO gnFieldCount
?gaMyArray(nCount,1)
field_name = gaMyArray(nCount,1)
locate_name = ('table1.' + field_name)
?locate_name
LOCATE FOR (locate_name) = 'Ray'
DO WHILE FOUND( )
gnCount = gnCount +1
? " It matches: " + fname
CONTINUE
ENDDO
ENDFOR
? ' Total Matches: ' + ALLTRIM(STR(gnCount))