Shopping Cart

Search:

Signup

Contact

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

# FileMaker Pro Custom Functions

get_Generation

Rate this function:

Discuss this Custom Function

John Pollard, generic human studies
http://generichumanstudies.com

Find Generation

Sample Input:
 a birthday
Sample Output:
 Baby Boomer

Then copy & paste into FileMaker Advanced's Edit Custom Function window.

## Description:

Just a calc to determine what "generation" a person was born according to the marketing mode people. I hope it's right.

Given a nice tight edit by vr, who clarified some issues about it. I suppose I should fix the astrological one as well.

;-)

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

## Discuss:

The Case() function returns the result of the FIRST test that returns true - so you could shorten the whole thing to just:

Let (
y = Year ( birthday )
;
Case (
y < 1900 ; "Too old" ;
y ≤ 1945 ; "Silent Majority" ;
y ≤ 1954 ; "Baby Boomer" ;
y ≤ 1965 ; "Gen Jones" ;
y ≤ 1976 ; "Gen X, Lost" ;
y ≤ 1994 ; "Gen, Y, Millennial" ;
y ≤ 2006 ; "Gen Z" ;
"Too young"
)
)

Note:

1. Year (date) returns a number; to compare it with another year (also a number) you should not quote that number - otherwise the comparison will be alphabetical instead of numeric. Not critical when all numbers are four digits long, but still good practice.

2. The parentheses around the comparison are redundant;

3. You can save the repeated evaluation of Year ( birthday ) by storing it in a variable.

comment, VR
March 22, 2015 3:51pm

Hey VR,

I appreciate this. Could you work this magic on the astrological calc? So that's updated as well.

There's a year and month date, so i'm not sure what the approach would be there, but this sure is a cleaner version.

Many thanks,

JP

John, Sacramento
March 22, 2015 5:29pm

Old way it was, just for reference how not to do it.

Case( (Month(c0_person_birthday) = 3 and Day(c0_person_birthday) >= 21) or (Month(c0_person_birthday) = 4 and Day(c0_person_birthday) <= 19); "Aries";
(Month(c0_person_birthday) = 4 and Day(c0_person_birthday) >= 20) or (Month(c0_person_birthday) = 5 and Day(c0_person_birthday) <= 20); "Taurus";
(Month(c0_person_birthday) = 5 and Day(c0_person_birthday) >= 21) or (Month(c0_person_birthday) = 6 and Day(c0_person_birthday) <= 20); "Gemini";
(Month(c0_person_birthday) = 6 and Day(c0_person_birthday) >= 21) or (Month(c0_person_birthday) = 7 and Day(c0_person_birthday) <= 22); "Cancer";
(Month(c0_person_birthday) = 7 and Day(c0_person_birthday) >= 23) or (Month(c0_person_birthday) = 8 and Day(c0_person_birthday) <= 22); "Leo";
(Month(c0_person_birthday) = 8 and Day(c0_person_birthday) >= 23) or (Month(c0_person_birthday) = 9 and Day(c0_person_birthday) <= 22); "Virgo";
(Month(c0_person_birthday) = 9 and Day(c0_person_birthday) >= 23) or (Month(c0_person_birthday) = 10 and Day(c0_person_birthday) <= 22); "Libra";
(Month(c0_person_birthday) = 10 and Day(c0_person_birthday) >= 23) or (Month(c0_person_birthday) = 11 and Day(c0_person_birthday) <= 21); "Scorpio";
(Month(c0_person_birthday) = 11 and Day(c0_person_birthday) >= 22) or (Month(c0_person_birthday) = 12 and Day(c0_person_birthday) <= 21); "Sagittarius";
(Month(c0_person_birthday) = 12 and Day(c0_person_birthday) >= 22) or (Month(c0_person_birthday) = 1 and Day(c0_person_bi

John, Sacramento
March 22, 2015 5:57pm

use DayOfYear() and 1 somewhere for leap year.

unix, Japan
March 22, 2015 7:54pm

@John:
Join a forum, e.g. http://fmforums.com

comment, VR
March 24, 2015 10:42am

 Your Name: City/Location: Comment: characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted. Answer 0 + 6 =
 Search for Custom Functions:

 Download the Custom Function Dashboard Widget for OS X Keep all the latest Custom Functions right at your fingertips!

 1. ExcludeValues(MyList ; Out) (Wed, Mar 21, 7:23am) 2. PreviousMonthEndDate ( myDate ) (Wed, Mar 07, 3:35am) 3. PreviousMonthName (myDate) (Wed, Mar 07, 3:33am) 4. FmTableFields ( tableName ; fieldsInclude ; fieldsExclude ; classExclude ; typeExclude ; prefixExclude ) (Fri, Mar 02, 6:32am) 5. sql.getTable ( fullyQualifiedFieldObject ) (Thu, Feb 22, 8:36am) 6. sql.getField ( fullyQualifiedFieldObject ) (Thu, Feb 22, 8:34am) 7. FilterOut ( ListA ; ListB ) (Wed, Feb 21, 6:11pm) 8. Char0 ( ) (Sun, Feb 18, 2:35am)