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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

field splitting

Status
Not open for further replies.

learnfox2

Technical User
Jul 10, 2007
5
US
What is the command to break a field after a specific # of characters is reached?
If I want to move items from address1 into address2 when address 1 is greater than 60 characters, how do I do this using microsoft visual foxpro?
 
Olaf,

as a customer I simply would like to be able to enter my adress as it should be printed.

I couldn't agree more. It always annoys me when I am forced to enter each line in a specific field, regardless of the "natural" format of the address.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
For us, unfortunately, the memo does not work. We need at least the zip code to be isolated. This is because our client, for marketing purposes, needed to know where their customers are coming from... Another limitation we have is we have to measure the distance from the clients site to the customers for delivery and pickup charges of semi-trailers (trucking) and overseas containers, thus the need for seperate fields for street, city, state and zip.
 
Imagincorp,

I didn't talk about memo only...

suppose your customer entered the details, so you can do your adress verification, determine distance etc.,
present to the customer how his adress will be printed and give him the opportunity to edit that, eg. line order etc.
especially for INTL customers.

You may check if the edited adress still contains all the single informations and the customer didn't edit it to something completely different. But the memo would just be additional data. Somehow redundant, but if the delivery fails - the customer has had the opportunity to turn the adress to the format valid in his country.

Bye, Olaf.
 
Sorry Olaf; misunderstood you...Yes we do that verify as well as allow the user to edit his or her address...
 
Mike - what you're suggesting is similar to what Outlook does. I've found Outlook to be pretty smart about parsing addresses. But when it can't or you don't like what it's done, you can fix it yourself. It's a great compromise between fully structured addresses and letting users enter exactly what they want.

Tamar
 
Been here done that got the tee shirt.

Trying to normalise addresses will tie you and your customers up in unnecessary knots. I have never come across a situation where it works.

If you create a memo field and put tags in front of specific lines

For instance the name could be [NAME] Joe Bloggs
post code line could be [POSTCODE] SW1 5XY

If you wanted to get out all post codes in SW1 you could write some code like

Code:
scan
    For lnI = 1 to mlines(memofield)
        lcStr = mline[lnI,memofield]
        if '[POSTCODE]' $ lcStr and 'SW1' $ lcStr
            ?lcStr
        endif
    next
endscan

The other option is have known data on each line so a post code would always be for example line 6

I am not really in favour of a field for each line as the field length has to be longer than the longerest bit of data in that field.




 
Bertie,

I've considered using memo fields, in the way you suggest.

One of the problems is that it's difficult to control the amount of text the user enters. It is a free-text field, after all. Also, searching for a postcode the way you suggest is certainly possible, but it can't be optimised and will therefore be very slow with a large table.

Re having "known data on each line", I always resist the idea of having specific fields for town, county, province or whatever (except in the case of American and Canadian addresses, where such a scheme is essential). That kind of structure simply doesn't work for non-American addresses, and in any case has no benefit. But postcodes are different. Becaue the postcode is often used for searching, sorting and general analysis, it makes good sense to keep it separate from the address.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top