Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Finding text on memory cursor to replace
Message
 
 
To
22/02/2007 18:29:47
Luis Santos
Biglevel-Soluções Informáticas, Lda
Portugal
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01198153
Message ID:
01198154
Views:
8
lcOldTxt = "por letra"
lcNewTxt = "por Chq"
* SQL way. May be slow because it locks/unlocks each record 
UPDATE teste ;
    SET descricao = STRTRAN(descricao, lcOldTxt, lcNewTxt) ;
  WHERE descricao LIKE ("%" + lcOldTxt + "%")

* VFP way. The fastest but locks table header for the duration of command execution.
REPLACE descricao WITH STRTRAN(descricao, lcOldTxt, lcNewTxt) ;
  FOR lcOldTxt $ descricao
* OR
SCAN FOR lcOldTxt $ descricao
  REPLACE descricao WITH STRTRAN(descricao, lcOldTxt, lcNewTxt)
ENDSCAN
>my program dislay a cursor that give information to insert line on my acounting program.
>i need to know how can replace dterminate text on one column field of my cursor and changing to another texte:
>for example
>cursor name : teste
>column field to find portion of text: teste.descricao
>text returning by cursor : Reg.de V/Factura nº 127b por letra.
>text to replace : por letra
>new text : por Chq
>
>i have the following sintax:
>select teste
>scan for teste.descricao = "%"+'por letra'+"%"
>if not eof()
>replace teste.descricao with "por chq"
>endif
>endscan
>
>i pretend returning on my cursor in column teste.descricao : Reg.de V/Factura nº 127b por chq.
>
>Also , i need to refresh this cursor on my screen after running this code.
>
>Many thanks
>Luis Santos
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform