Home » Uncategorized » VFP Reporting Tip – paying it forward
Jun
12

I was mentoring one of our clients this morning because of a reporting issue he faced with some weird truncating labels (not that this tip is of any help for his problem {g}). During the session he showed me this new wiz-bang function he created to concatenate text together to be displayed on the report. He mentioned how his function removes the missing details from a snail mail address. You know the drill, customer wants to track address line 1 and 2, contact name and company name, but only wants to print the things that are filled in.

I turned around and told him about his new friend the semi-colon (;). This is a trick I learned back probably in FoxPro for Windows or even DOS when I was creating labels for customer mailings. You first drop a textbox on the Report/Label designer and size it to show the max lines you will print based on all the data being entered in the record. You can add the expression like this:

cCustomerName;cCompany;cAddress1;cAddress2;ALLTRIM(cCity)+”,”,cState,cPostalCode;cCountry

The semi-colon acts as a carriage return and any columns in the expression that are empty are not printed and if the line is empty the carriage return is not included. The commas (,) outside of a quote are replaced by spaces. So you can see how I am concatenating the city, state, and postal codes for a line.

I know this is an old trick and tip, but my client has been using Fox of some sorts for a long time too so in the case where you did not know this I am hoping it will be helpful. There are so many little things like this I take for granted that everyone knows, but realize in working with other Fox developers that this is not always the case. I also wonder from time-to-time how many little tips like this one I don’t know about.

, ,

6 Responses to “VFP Reporting Tip – paying it forward”

  1. June 12th, 2008 at 22:15 | #1

    This is an old trick ?
    Well, super new for me :-D
    I owe you a beer for that !
    Thanks !

  2. June 13th, 2008 at 06:51 | #2

    Thanks for verifying my point Cesar. You are welcome, and virtual lemonade would be fine. {g}

  3. June 13th, 2008 at 12:03 | #3

    Oh, man, I’ve been working with Fox for 15++ years and I did not know this. Thanks, Rick.

  4. June 17th, 2008 at 18:45 | #4

    Yep, add me to the list.
    That’s a new one for me too.
    Thanks Rick.

  5. July 24th, 2008 at 18:54 | #5

    That is very cool. I’ve been playing with fox since the mid 80′s and never knew that.

  6. Anonymous
    June 23rd, 2009 at 14:10 | #6

    I have been fighting address since foxbase and have never seen any reference to this trick.
    Thanks Rick
    Jerry Foote

Add reply