Parse, Array And Concatenation In FileMaker Design

From Dwayne Wright PMP
Certified FileMaker Developer

WEB: www.dwaynewright.com
EMAIL: info@dwaynewright.com
TWITTER: dwaynewright
YOUTUBE: FileMakerThoughts

Please Note: If you are viewing this page in a news feeder, the images may get munged up a bit or other formatting of the posting may fail. For the best experience, please visit the journal directly by clicking (here).

Common terms describing the ways of breaking up a long text string (such as exported from another database) or putting together 2 or more text string (to build a relationship key between databases comprising of 2 or more fields... many times called a calculated key).

PARSE - Parse can be described as breaking up a text string or the contents of a text field into smaller pieces. These parsed pieces can be put into other text fields, used in other calculation fields or be used to control how a FileMaker script behaves. Let’s say that you inherit a database that has one field for the full name of a person. You could create a first name field and a last name field ... and then ... parse the full name data into the two correct fields.

Parsing information has always been a popular need for advanced database designers but it went to an entirely new level when the internet started hitting it’s stride. After all, a web page is just a bunch of text that is separated by a bunch of tags ( specific text strings used to format the page ). In fact, you can say that your web page browser ( Internet Explorer, Netscape, etc...) is a big parsing machine.

It is not uncommon for a developer to build a text string that they know they may want to parse someother time. This is a great way to send a bunch of data in one string. When this is done, it is common to us a delimiter. A delimiter is a unique single character or a unique combination of characters that cannot be found naturally in the data. When you see the term of CSV as an export format, that stands for comma separate values. The comma is used as a delimiter. The most common character I’ve seen is the bar character ( | ) which can be found above the return key on the keyboard and you have to hold down the shift key to enter it.

So a text field could have something like...

Dwayne Wright | info@dwaynewright.com | www.dwaynewright.com

which can be seen as developer, delimiter, email address, delimiter, web site address

ARRAY - A collection of data in a specific, organized, identical and repeated order. You might think of it like a group of marching soldiers. Each is doing the same thing as a whole but each individual piece is quite different. They are just moving in ... well ... a specific, organized, identical and repeated order. An example of an array could be your TV guide. Each day is in an array of shows that will appear on a specific time, channel and day. However, you could want to PARSE that array to find out when Gomer Pyle is on during the entire week.

CONCATENATE - This applies to putting two more fields together to build a calculated result. Say we want to build an array of peoples names, titles and phone numbers. We have those three fields for all the records in a found set and we want to combine them into one field on one records that we can later parse out into 3 fields and however many records again (using FileMaker text functions and a script). Typically, I use the "|" character when separating the text strings. This is the character above the return key with the shift held down. Using this character, my array of LeSaux folks would look something like...

Dwayne|Wright|Designer|2174423038
John|Reid|WebMan|2174423028
Dan|Wright|Marketing|2174423028
Marianna|Beasley|Bookeeping|2174423028

Using 4 fields and four records, I have concatenated them into one array that could later be parsed out by using FileMaker text functions by looking for the "|" character and/or the a carriage return. Then I would slice the data from both sides of the "|" character and create a new record once I encounter a carriage return.

=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2007 - Dwayne Wright - dwaynewright.com

The material on this document is offered AS IS. There is NO REPRESENTATION OR WARRANTY, expressed or implied, nor does any other contributor to this document. WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.