Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6515 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Parsing an Address

This problem is beyond my abilities. Any help will be much appreciated.

I would like to parse a field which contains an address into separate fields.

Example:

LastName

FirstName

Title

CompanyName

Address

City, State, ZipCode

Phone

email

WebAddress

If you do not have time to answer this question, can you point me to where I can find the solution.

Thanks in advance for your help - Sam

Posted

Thanks Raybaudi,

Each name needs to be parsed to a separate field:

LastName to a lastname field

FirstName to a firstname field

CompanyName to a companyname field

ect.

Each field name needs to go into a separate field.

Posted

Sam, you still havent given us enough info to work with. How is the raw data setup? Is it one big entry? How is the data delineated? Tabs? Spaces?

The more info yu can give, the better we can assist you.

Posted

Sorry all. Did not know what was required.

The addresses are copied from a text file and pasted into a text field in FM. Each line has a return (¶) after it.

LastName¶

FirstName¶

Title¶

CompanyName¶

Address¶

City, State, ZipCode¶

Phone¶

email¶

WebAddress¶

Do you need any more info? Thanks for taking the time.

Posted

Since you are on FM7, you can make use of the MiddleValues function. You can use this in a script or for each field, a calculated auto entry.

Substitute ( MiddleValues ( PARSEFIELD ; x ; 1 ); "¶"; "" )

Where x is the starting location for the parse value. for example, x = 1 for LastName, x=2 for FirstName, etc.

For the City, State, & Zip, you could parse out the line first, then use a similar method to parse each one.

City

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); ","; "¶"); 1 ; 1 ); "¶"; "" ) )

State

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); ","; "¶"); 2 ; 1 ); "¶"; "" ) )

Zipcode

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); ","; "¶"); 3 ; 1 ); "¶"; "" ) )

Posted

mr_vodka

I tried your solution and it worked fine until I tried to break state and zip code into separate lines. Because there is no period or comma after state the script sees them as one. How can I fix this so that all three (city, state & zip) break into three lines.

Here is what you gave me for state and zip code:

State

Trim ( Substitute ( MiddleValues ( Substitute ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); "¶"; "" ); ","; "¶"); 1 ; 2 ); "¶"; "" ) )

Zipcode

Trim ( Substitute ( MiddleValues ( Substitute ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); "¶"; "" ); ","; "¶"); 1 ; 3 ); "¶"; "" ) )

Thanks again - Sam

Posted

Actually, I am not quite there yet. I am getting carrage returns in the individual fields and I don't want them. How do I get the script not to put carrage returns in each field? Does "¶" have something to do with returns. I don't know what "Â" means.

Thanks in advance - Sam

Posted

Your text has actual "¶" signs in it? I thought you meant that "¶" represented a carriage return as it should.

LastName¶

FirstName¶

Title¶

CompanyName¶

Address¶

City, State, ZipCode¶

Phone¶

email¶

WebAddress¶

Posted

Once you get rid of the pilcrow "¶" from your raw data, then you can just use these as long as it is ALWAYS in the format 'City, State Zipcode'. In your earlier example, you had it as 'City, State, Zipcode'

State

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); " "; "¶"); 2 ; 1 ); "¶"; "" ) )

Zipcode

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); " "; "¶"); 3 ; 1 ); "¶"; "" ) )

Posted

John - you have been so helpful, I was hoping you can help me with one last issue. How do i deal with the difference between a city that has one word verses on that has two.

Here is what I have for parsing city, state and zip code:

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); " "; "¶"); 1; 1 ); "¶"; " " ) ) & ¶ &

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); " "; "¶"); 2; 1 ); "¶"; "" ) ) & ¶ &

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); " "; "¶"); 3; 1 ); "¶"; "" ) )

This returns:

Boston

MA

02453

But if the city has two words than I get this:

San

Francisco,

CA

Thanks again for your help - Sam

Posted

Sam, notice that my last post was only for state and zipcode. The city parse step was not changed. It seems as if you changed that one as well.

Posted

John - as you can see you are dealing with someone who is a novice at all this. I have corrected the lines you mentioned, but I still have the same problem. Here is the script for city, state and zipcode:

Trim ( Substitute ( MiddleValues ( Substitute ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); "¶"; "" ); ","; "¶"); 1 ; 1 ); "¶"; "" ) ) & ¶ &

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); " "; "¶"); 2 ; 1 ); "¶"; "" ) ) & ¶ &

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( leads::import; 3 ; 1 ); " "; "¶"); 3 ; 1 ); "¶"; "" ) )

This works fine for: Vernon, NJ 07462 which gives me:

Vernon

NJ

07462

But when I try it on this: San Francisco, CA 94122 I get this:

San Francisco

Francisco,

CA

Any ideas as to what I am doing wrong?

As always, thanks for your help - Sam

Posted

City

Trim ( Substitute ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); [color:red]","; "¶"); 1 ; 1 ); "¶"; "" ) )

State

Trim ( Substitute ( LeftWords ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); ","; "¶"); 2 ; 1 ); 1 ); "¶"; "" ) )

Zipcode

Trim ( Substitute ( RightWords ( MiddleValues ( Substitute ( MiddleValues ( PARSEFIELD; 6 ; 1 ); ","; "¶"); 2 ; 1 ); 1 ); "¶"; "" ) )

Posted

Thanks John, but your last post solution created empty entries in the import2 field. Don't worry though because I decided to create two scripts, one for one name city and the other for a two name city.

thanks for all you help - Sam

This topic is 6515 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.