Thank you for visiting the FileMaker Calculations Explored blog. I recently moved this content over from my blogger account. Hope you like it! When you get a chance, check out the centralized search feature for all the FileMaker blogs found along the right side panel. It is quite handy!

Saturday
May222010

FILEMAKER: The Get(SortState) Function

© 2010 Dwayne Wright - dwaynewright.com

From Dwayne Wright PMP - Certified FileMaker 10, 9 & 8 Developer
EMAIL: info@dwaynewright.com     TWITTER: dwaynewright

CHAPTER 18: Get Functions

Get(SortState)
FMP Version: FileMaker 7 And Higher
Returns A Number Result

The Get(SortState) function will return a numeric result corresponding to the fact that a set of records is sorted, semi-sorted or not sorted. Semi-sorted is a condition where a found set of records was sorted but new records have been added. So all but the new records correspond to the last sort order.

If the found set of records is sorted, it will return a 1
If the found set of records is not sorted, it will return a 0
If you see a 2, that means the found set of records is semi-sorted.

Now with FileMaker 10 (and higher), this function isn’t as important as previous versions. This is because FileMaker will automatically sort found sets of records when new data is added or edited! Still, this is a nice feature and one way to key a conditional formatting feature to give the user a visual indication if a found set is sorted or not!

Friday
Mar262010

Easy Example Of The FileMaker Let Function

From Dwayne Wright PMP
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. 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 we define 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. That sets up the last calculation that pulls out the desired data with the Middle function!

Friday
Mar262010

FILEMAKER: WordPosition Custom Function By Daniele Raybaudi, ACI

© 2010 Dwayne Wright - dwaynewright.com

From Dwayne Wright PMP - Certified FileMaker 10, 9 & 8 Developer
EMAIL: info@dwaynewright.com     TWITTER: dwaynewright

CHAPTER 20: Custom Functions

Came across another parsing related custom function this week that I wanted to share with you. This one is called WordPosition found at briandunning.com and uploaded by Daniele Raybaudi, ACI. Here is a direct link where you can find it ...

http://www.briandunning.com/cf/474

The project that I’m working on is parsing pdf versions of multiple column documents created by InDesign. In each piece of data I copy, I might have to populate 30 - 40 fields. In some cases, I have to detect for strings within the text that will ultimately reside in portals.

In my latest task, I’m taking the entire string of data and slicing them into individual portal rows. Then I’m addressing each portal row one at a time. In this implementation, the WordPosition function is very helpful. I can look for a label and then use the left, right and middlewords functions.

In hindsight, I’m kind of amazed FileMaker doesn’t provide a core WordPosition function.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

Wednesday
Mar242010

FILEMAKER: IsNumberInRange By Ibrahim Bittar Torres, Eikonsys

© 2010 Dwayne Wright - dwaynewright.com

From Dwayne Wright PMP - Certified FileMaker 10, 9 & 8 Developer
EMAIL: info@dwaynewright.com     TWITTER: dwaynewright

CHAPTER 20: Custom Functions

IsNumberInRange By Ibrahim Bittar Torres, Eikonsys
IsNumberInRange ( Number , LowerLimit , HigherLimit )
Determines if a given number falls between two reference numbers.
http://www.briandunning.com/cf/604

Wanted to pass along this link to a custom function I used today. I was doing a common parsing task for a customer. Given a large block of text, I was examining it line by line and putting significant data from the block into key fields. On one line, I needed to know if the last word was a number or not. If it was a number, I needed to populate a field named “Level” but leave the field empty if the last word was not a number.

I did a quick search on briandunning.com and it took a few searches to find this one. This isn’t exactly what I was looking for but it was close enough! Check out the link above for the code particulars or to learn more about this functions creator.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2010 - Dwayne Wright - dwaynewright.com

Wednesday
Mar172010

A READER ASKS: FileMaker Validation For Year

© 2010 Dwayne Wright - dwaynewright.com

From Dwayne Wright PMP - Certified FileMaker 10, 9 & 8 Developer
EMAIL: info@dwaynewright.com     TWITTER: dwaynewright

APPENDIX 1: A Reader Asks

A READER ASKS
I am fairly new to FM and am trying to make a solution for my Church.

I have used many of your recourses to get started. Thanks so much for them!

I want to set up validation of a date field so that dates entered can only be of a certain year (using a drop down calendar).

The “In Range” works but the date restriction changes from year-to-year and I don’t always want to have to edit that fields properties each year, but get the restriction from a field on the database.

I am trying to use the validate by calculation, but I can’t seem to find a calculation that will work.

-------
DWAYNE RESPONDS
Try using the Year function within your calculation. The year function is found in the Date family of functions and it extracts the year information only from a properly formatted date string in a date field or text field wrapped properly with the GetAsDate function.

For example, the information of 6/1/98 would return 1998 only or 3/17/2010 would simply return 2010. So when you exit the field, the validation would simply check to make sure the year entered equals some other year you specify (either hard coded, based upon another field or via a calculation).

Many times, the year function is used in conjunction with other function as part of a nested function. For example, Get(CurrentDate) returns the current date but what if you just want the current year? Year(Get(CurrentDate) would do the trick.
=
More info about the author and FileMaker in general, contact me at info@dwaynewright.com.

© 2010 - Dwayne Wright - dwaynewright.com