Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Concatenating report fields

Status
Not open for further replies.

BlackDice

Programmer
Mar 1, 2004
257
US
I don't know if everybody else knows this already, but I just found this out in a book entitled "The Visual FoxPro Report Writer". It says to concatenate fields, instead of using iif()'s, spaces, and +'s just use a comma in between the field names. This will put a space in between the fields and nothing for an empty field. You can also use semicolons to put text on different lines, and it won't make an extra line for a field that is empty. So if you have two address fields, you can put in
Code:
address1;address2;city+",",state,zip
and if there's no address2, it won't put an empty line for that field. haven't had much use to try it out myself yet, but it sounds very useful

bdiamond
 
Yes, Cathy's book is full of trick's that us oldtimers used back in the FoxPro DOS days, that still w4ork in the current versions.

Another one is to use the - instead of the + for concatenation - it will move trainling spaces to the end. So instead of writing:
Code:
City = "Lansing          "
State = "MI"
?Trim(city)+","+state
* you can write
?city-","-state
Rick
 
cool, thanks!!

bdiamond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top