Hi,
I'm making a quick function to find and replace occurrences of data within tables (procedure findreplace(table, field, find, replace)) to simplify some scripts I'm working on, but I can't figure out a way to index on the passed in field. I figured "index on (variable) to index" would work as "use (table)" works, but it just tries to index on "(variable)" instead of the contents of the variable. Does anyone know a way to get this working or have an alternate solution?
[tt]USE (tbl) IN 0
INDEX ON fld TO tempidx
GOTO top
DO WHILE NOT EOF()
IF SEEK(find)
replace (fld) with repvar
ENDIF
SKIP
ENDDO[/tt]
Thanks!
I'm making a quick function to find and replace occurrences of data within tables (procedure findreplace(table, field, find, replace)) to simplify some scripts I'm working on, but I can't figure out a way to index on the passed in field. I figured "index on (variable) to index" would work as "use (table)" works, but it just tries to index on "(variable)" instead of the contents of the variable. Does anyone know a way to get this working or have an alternate solution?
[tt]USE (tbl) IN 0
INDEX ON fld TO tempidx
GOTO top
DO WHILE NOT EOF()
IF SEEK(find)
replace (fld) with repvar
ENDIF
SKIP
ENDDO[/tt]
Thanks!