6 Replies Latest reply on Mar 20, 2015 8:36 PM by philmodjunk

# Listing birthdays script

### Title

Listing birthdays script

### Post

I am having trouble trying to find a way to list all the birthdays within the next 30 days.  I have 3 fields under table Clients.

1. BirthMonth ; 2. BirthDay; 3. BirthYear

Thank you for any help with this.

• ###### 1. Re: Listing birthdays script

Define an unstored calculation field that computes the person's next birth day:

Let ( [ T = Get ( CurrentDate ) ;
Bd = Date ( BirthMonth ; BirthDay ; Year ( T ) ) ;
If ( Bd < T ; Date ( birthMonth ; BirthDay ; Year ( T ) + 1 ) ; Bd )
)

Now you can use a find script that uses this script step:

Set Field [ YourTable::cNextBirthDay ; Get ( CurrentDate ) & "..." & Get ( CurrentDate ) + 30 ]

See this thread for examples of find scripts that use Set Field to build find requests: Scripted Find Examples

• ###### 2. Re: Listing birthdays script

Creating an unstored calculation field with:

Let ( [ T = Get ( CurrentDate ) ;
Bd = Date ( BirthMonth ; BirthDay ; Year ( T ) ) ;
If ( Bd < T ; Date ( birthMonth ; BirthDay ; Year ( T ) + 1 ) ; Bd )
)

and I keep getting, "A number, text constant, field name or "(" is expected here."

• ###### 3. Re: Listing birthdays script

Let ( [ T = Get ( CurrentDate ) ;
Bd = Date ( BirthMonth ; BirthDay ; Year ( T ) ) ];
If ( Bd < T ; Date ( birthMonth ; BirthDay ; Year ( T ) + 1 ) ; Bd )
)

might just  need that closing bracket

• ###### 4. Re: Listing birthdays script

Yep.

• ###### 5. Re: Listing birthdays script

That worked!  One thing though, it seems to be bringing birthdays within next 30 days but it list some people that has already passed their birthday but also for next year.

Example

John 3/4/2016

Stacie 3/8/16

• ###### 6. Re: Listing birthdays script

That's exactly what it should do. It computes each person's next birthday. you then perform a search on this field to find those that have a birthday from today to 30 days into the future. See my original post.