Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy one - function with table and field
Message
From
26/09/2004 20:43:00
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
26/09/2004 19:09:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00946132
Message ID:
00946149
Views:
20
Hi Paul

How about this one? It only processes the records that need to be processed. It closes the table if it did open it. It reselects the original workarea when finished.
FUNCTION replacechar
LPARAMETERS m.tcTable, m.tcField
LOCAL m.lnSelect
m.lnSelect = SELECT()

LOCAL m.llCloseIt
IF USED(m.tcTable)
  m.llCloseIt = .F.
ELSE
  m.llCloseIt = .T.
  USE (m.tcTable) IN 0
ENDIF
SELECT (m.tcTable)

REPLACE ;
  (m.tcField) WITH STRTRAN(EVALUATE(m.tcField),"(",""), ;
  (m.tcField) WITH STRTRAN(EVALUATE(m.tcField),")","-") ;
  FOR "("$&tcField. OR ")"$&tcField.

IF m.llCloseIt = .T.
  USE IN SELECT(m.tcTable)
ENDIF

SELECT (m.lnSelect)
ENDFUNC
Previous
Reply
Map
View

Click here to load this message in the networking platform