Page 1 of 1
AT Function Query
Posted: Tue Dec 20, 2011 11:34 am
by mbentote
I am searching a field containing a file pathname (e.g. C:LegalMDBletter.doc) for the rightmost character. I am using Visual FoxPro and Report Works version 12 and 8. The RAT function would be ideal but is not available. When I try to use the AT function to look for the nth occurrence e.g. using AT(^^,docpath,3) to find the 3rd ocurrence it only finds the first occurrence as if the expression used was AT(^^,docpath). Am I doing something wrong, is the function not working correctly or is there another way of doing this?
=> RE: AT Function Query
Posted: Tue Dec 27, 2011 12:36 pm
by cstrasser
ReportWorks and FoxPro have many functions in common, but the AT() and RAT() are not among them.____The choice for R&R is to use the StrSearch() function. From the help:____*******************__STRSEARCH__Returns the beginning position of the nth occurrence of a character substring. ____Syntax:__STRSEARCH(C1,C2,N,L) where C1 is the substring, C2 is the full character string, and N is the number of the occurrence. If N is negative, STRSEARCH begins its search for the substring_s position at the end of the character string. (Note that the position of the first character in a string is 1, not 0.)____The optional logical expression L controls the case sensitivity of the function. When L is true, the function is case sensitive; when it is false, the function is case insensitive. When this argument is not provided, the function uses the case sensitivity setting in the RRW.SRT file (see Chapter 5, "Setting Defaults," for information about configuring case sensitivity).____Example:__To extract the nickname from a BOXER_NAME character field, create a field with the following expression:____SUBSTR(BOXER_NAME,STRSEARCH("(",BOXER_NAME,1)+1,__STRSEARCH(")",BOXER_NAME,1)_STRSEARCH("(",BOXER_NAME,1)_1)____For a value of BOXER_NAME such as "Billy (The Bruiser) Johnson," this field will return : The Bruiser.__