Working with Left and Right String Functions

Continuing on working with the functions in Business Objects Crystal Reports I thought we could look at the Left and Right functions.  I know to some of the readers this may be some simple stuff but remember I try to write to new users of Crystal and SalesLogix reporting.


When I think of working with these function the first thing that comes to my mind is the military.  While serving in the National Guard I have had the opportunity to use these functions in script in creating reports.  By regulation a Soldiers social security number is used as a unique identifier.  The military is trying to be smart and not throw this important id number on the many lists they deal with everyday so they often use what is called a laundry mark.  


A laundry mark is a combination of the soldiers first initial of the last name and the last four of the SSN.  To programmable call the laundry mark out of data we can use the Left and Right String functions.  For our example we will use the Sage SalesLogix Contact tables Last Name and Work Phone.  To display this data in Crystal we would create a formula field called Laundry Mark.  


When the Field Formula Workshop opens look for the Function Tree.  If the Function Tree is not displaying select the Alt and U keys.  Navigate to the String Value in the Function Tree and click on the plus sign next to it. 


 You can see the Left value in the list, the right is a little further down but the process is the same for each.


Left (str, length)


There are two parameters for these function, the first is the string.  If you are using a integer or double field type you would have to convert the field to a string.  Both of our fields are string fields.


The second parameter is the number of characters from the left you want to collect.  For lastname we only need first character but for the workphone we will use the last four characters.


Our formula for LaundryMark field would look something like.


Left(lastname, 1) & Right(workphone, 4)


The data will look something like this when inserted into your report.


J0214


We will go into the Conversion next.


Remember our list of free SalesLogix Reports


 


 


 

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) news and product updates!

You have Successfully Subscribed!