AT Function Query

Meeting place for R&R customers and clients to share tips and ideas. Post your questions, messages or problems here.
Post Reply
mbentote
Posts: 3
Joined: Tue Oct 10, 2017 12:44 pm

AT Function Query

Post by mbentote » Tue Dec 20, 2011 11:34 am

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?

User avatar
cstrasser
Posts: 155
Joined: Tue Oct 10, 2017 12:44 pm

=> RE: AT Function Query

Post by cstrasser » Tue Dec 27, 2011 12:36 pm

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.__
Chris Strasser
Liveware Publishing, Inc.
Work bigger.

Post Reply