AT(" ",STRTRAN(insured.po_name," ","*",1)) > 0Should always be false, so the first iif() condition can never be met since you are checking for the position of a space in a string where you have replaced all spaces with asterisks. Therefore, execution will always land on the the second iif(), so the first one could be eliminated.
xreturn=BETWEEN(UPPER(LEFT(insured.po_name,; IIF(AT("*",STRTRAN(insured.po_name," ","*",1))> 0,AT("*",STRTRAN(insured.po_name," ","*",1))-1,; LEN(insured.po_name)))),; UPPER(xfrom),UPPER(xto))Or am I missing something?
> xreturn=BETWEEN(UPPER(LEFT(insured.po_name,; > IIF(AT(" ",STRTRAN(insured.po_name," ","*",1)) > 0,AT(" ",STRTRAN(insured.po_name," ","*",1))-1,; > IIF(AT("*",STRTRAN(insured.po_name," ","*",1))> 0,AT("*",STRTRAN(insured.po_name," ","*",1))-1,; > LEN(insured.po_name))))),; > UPPER(xfrom),UPPER(xto)) >>
>>*!* Assumes set exact on >>RETURN BETWEEN(UPPER(LEFT(insured.po_name,; >> IIF(AT(" ",insured.po_name) > 0,AT(" ",insured.po_name)-1,; >> IIF(AT("*",insured.po_name)> 0,AT("*",insured.po_name)-1,; >> LEN(insured.po_name))))),; >> UPPER(xfrom),UPPER(xto)) >> >>>>
>>>xreturn=.T. && include this record, .f. if record does not meet condition >>> IF !EMPTY(xfrom) OR !EMPTY(xto) >>> IF ALLTRIM(UPPER(xfrom))=ALLTRIM(UPPER(xto)) >>> IF ALLTRIM(UPPER(xfrom)) $ LEFT(UPPER(LEFT(STRTRAN(insured.po_name," ","*",1),; >>> AT("*",STRTRAN(insured.po_name," ","*",1))-1)),LEN(ALLTRIM(UPPER(xfrom)))) ; >>> .AND. UPPER(LEFT(STRTRAN(insured.po_name," ","*",1),; >>> AT("*",STRTRAN(insured.po_name," ","*",1))-1)); >>> <= UPPER(ALLTRIM(xto)) >>> ? po_name+ " YES a match" >>> xreturn = .T. >>> ELSE && not a match >>> ? po_name+" NO not a match" >>> xreturn = .F. >>> ENDIF >>> ELSE >>> *--TCH 08/13/2003 * for SMITH III*JAMES, etc >>> *IF !BETWEEN(UPPER(LEFT(insured.po_name,AT("*",insured.po_name)-1)),xfrom,xto) >>> IF !BETWEEN(UPPER(LEFT(STRTRAN(insured.po_name," ","*",1),; >>> AT("*",STRTRAN(insured.po_name," ","*",1))-1)),xfrom,xto) >>> xreturn = .F. >>> ENDIF >>> ENDIF >>> ENDIF >>>