How's this? It's pretty rough but.....
CLEAR
LOCAL ;
lcStr
lcStr = 'where code#parentcode.or.pcoflat="P"'
? lcStr
** You can add more symbols here as needed with a comma before and after
lcSymbols = ",#,.or.,=,"
FOR xx = 1 TO (OCCURS(",", lcSymbols))
lcSymbol = SUBSTR(lcSymbols, AT(",", lcSymbols, xx) + 1, AT(",", lcSymbols, xx + 1) - AT(",", lcSymbols, xx) - 1)
lcStr = STRTRAN(lcStr, lcSymbol, " " + lcSymbol + " ")
ENDFOR
? lcStr
lcStr = ;
STRTRAN(lcStr, " code ", " lnd1.Code ")
lcStr = ;
STRTRAN(lcStr, " parentcode ", " lnd1.ParentCode ")
lcStr = ;
STRTRAN(lcStr, " PCOFLAG ", " lnd1.PCOFLAG ")
? lcStr
>>If you put spaces before and after your fields names in your original lcStr, then search for the expression with the spaces before and after this should work.
>>
>>lcStr = ;
>> "WHERE Code # ParentCode OR PCOFLAG = 'P'"
>>
>>lcStr = ;
>> STRTRAN(lcStr, " Code ", " lnd1.Code ")
>>
>>lcStr = ;
>> STRTRAN(lcStr, " ParentCode ", " lnd1.ParentCode ")
>>
>>lcStr = ;
>> STRTRAN(lcStr, " PCOFLAG ", " lnd1.PCOFLAG ")
>>
>>
>>Lister...
>>
>
>Yes, I've realized this already :) Now the problem is to insert space before and after each symbol... Can you help me here? I'm working on it right now, if nobody has a brilliant idea how to do it without WSH.
>>>Hi everyone,
>>>
>>>I have some expression, which is either filter() or for() or combination of both. I'd like to insert Alias Lnd1 before each field, which may be in this expression. Example:
>>>
lcStr=where CODE#PARENTCODE.OR.PCOFLAG="P"
>>>
>>>I need to convert it to 'where lnd1.code#lnd1.parentcode OR lnd1.PCOFLAG="P"'
>>>
>>>I was thinking about checking this string against each field and do simple strtran, but it would not work, since I have fieldnames, which are part of other field names.
>>>
>>>Could you please help me?
>>>
>>>Thanks in advance.