Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Parsing an Address

Featured Replies

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

... but you have to give us an example ( or some ) of the field to parse !

  • Author

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.

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.

  • Author

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.

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 ); "¶"; "" ) )

  • Author

Thank you so much mr-vodka, I will give it a try.

Sam

  • Author

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

  • Author

Never mind, I figured it out

  • Author

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

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¶

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 ); "¶"; "" ) )

  • Author

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

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.

  • Author

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

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 ); "¶"; "" ) )

  • Author

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.