Hi Carmen
You could do this:
replace cateid with alltrim(left(cateid, at('PRDIT :', cateid) - 1)), ;
prodid with alltrim(substr(cateid, at('PRDIT :', cateid) + len('PRDIT :'))) ;
for ! eof()
In your example, this will leave the string "ABCDF31211" in cateid and put the string "1212111221" in the prodid field.
This code assumes that cateids may be different lengths and therefore you need to find where the prodID starts for each field. If your cateID field is always in a standard format (eg 10 characters, space, PRDIT space colon space, 10 characters) then you could just use:
replace cateid with alltrim(left(cateid, 10)), ;
prodid with alltrim(right(cateid, 10)) ;
for ! eof()
Cheers,
Andrew
>I have a field (called cateid) which contain the record eg. "ABCDF31211 PRDIT : 1212111221"
>
>How to trancate from this field starting from PRDIT onward til the end of record to another field (called prodid)
>I am trying to convert data from excel file to fox's table.
>
>Sorry for my english,Coding will be appreciated. thanks
If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?
From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."
All my FoxTalk and other articles are available on my
web site.
Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.