Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Text in Records
Message
From
05/12/2017 07:26:36
 
 
To
05/12/2017 07:14:52
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01656116
Message ID:
01656138
Views:
45
>>>Hi All,
>>>
>>>I have a Cursor with Field Name cText in which there are around 2000 records each of length from 10 to 254.
>>>In these records there is a word say "xyz' in between these Records. The xyz may be at any position inside the record.
>>>I need to change all the instances of this word xyz to say ABCD or any thing else, for all the records from top to bottom.
>>>
>>>Is there any simple way to it in a single command for all the records , other than scanning the entire File from Top to bottom using Scan-Endscan loop.
>>>
>>>I also don't want to use FILETOSTR(), occurs() etc as already I have created a cursor for some purpose and have taken Text in SDF.
>>>
>>>Thanks.
>>
>>What is the type of cText?
>
>Its varchar field. However i can change it to character if requured. currently i am using scan endscan loop. is there anything that can perform better. pls guide

Being Varchar or Character brings a problem for records that are already at full capacity of 254 characters, or close to that.

Replacing cText contents with STRTRAN(cText, 'xyz', 'ABCD') will damage your data for results that go over that limit.

You can change to Memo, and that will push the problem away, or introduce some logic in your program to handle the case (like breaking the record in two, which is what I suppose you're been doing somehow, upstream).
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform