Easy Example Of The FileMaker Let Function

From Dwayne Wright PMP, PMI-ACP
Certified FileMaker Developer

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

The Let function can be challenging the first time you encounter it. The Let Function allows you to use your own variables within the syntax of the function. It can be used to make complex calculations easier because you can reference just about anything as a variable. Today I did a quick Let function to parse out the contents between a pair of parenthesis and realized this is a very easy way to explain how a Let function works!



Let([
start = Position ( text ; "("; 1; 1)+1;
end = Position ( text ; ")"; 1; 1);
difference = end - start];

Middle ( text; start; difference))

 


The first variable tells us where the left parenthesis starts (plus one character), the second variable tells us were the right parenthesis ends and the last variables tells us the number of characters between each parenthesis. The position function returns the place where a specified string of text occurs within a search string.

That sets up the last calculation that pulls out the desired data with the Middle function! This function is used to pull a defined number of characters from a text string or field. Unlike the left or right functions, you can define where to start and the number of characters you want to extract. This function is commonly used in text parsing routines, where a large piece of text is broken down and placed into many different fields.

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

© 2013 - 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.