Software Technology Tips

Suppose a table has firstname and lastname as its fields and we want to show full name on the screen or in a report. The first expression that comes to mind is like :
 
 
SELECT TRIM(lastname)+' , ' + firstname from table .......
 
Or
 
SELECT ALLTR(lastname)+' , ' + firstname from table .......
  
 
However a easier way is :-
 
SELECT lastname - (', '+firstname) from table .........
 
The '-' is a another concatenation operator that removes trailing blanks from the element preceding the operator then joins two elements
NOTE :-
 
Note that there is a difference between using the '-' operator and ALLT in the above example.
 
The latter removes all blanks from last name while the former moves the trailing blanks from last name and adds them to the end of the resulting expression.
This is handy if you want the size of the resulting field to be equal to the total size of its elements..


Related Tags:

Visual FoxPro

Author: Avinash Acharya

Related Pages

  • FoxPro Development Expertise
  • FoxPro Database Projects

Miscellaneous

Let us Connect!

iso 9001 QA25 Red Herring STPI D&B Fastest Growing SME 2013 Award zinnov Nasscom

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login