3 Replies Latest reply on Mar 3, 2010 12:18 PM by comment_1

# Conditional Statement Using Fixed Date Field in the Calculation

### Title

Conditional Statement Using Fixed Date Field in the Calculation

### Post

This seems so simple, but I'm having trouble getting this to work.

I have a fixed date field and want 3 conditional caculation fields that either reflect the date or show nothing at all.  I'm on FMP 8, and don't have access to conditional formatting of text color, so I create 3 calcuation fields layer them on top of each other and format them in different colors.  Only the calc fields are shown on my print layout, and only one at any time actually shows the date.

Date: 1-20-2005

Calc 1:  If the date is less than 2 years old, show the date, else show blank

Calc 2:  If the date is more than 2 years old, but less than 4 years old, show the date, else show blank

Calc 3: If the dates is more than 4 years old, show the date, else show blank.

• ###### 1. Re: Conditional Statement Using Fixed Date Field in the Calculation

Making some progress.  I was missing a pair of ( ) around (date + xx). Calc 1 and Calc 2 are working.  Still looking for options on the formula for Calc 2

• ###### 2. Re: Conditional Statement Using Fixed Date Field in the Calculation

Correction; Calc 1 & 3 are working.  Looking for help with Calc 2

• ###### 3. Re: Conditional Statement Using Fixed Date Field in the Calculation

Try =

Let ( [
today = Get (CurrentDate) ;
age = Year ( today ) - Year ( YourDate ) - ( today < Date ( Month ( YourDate ) ; Day ( YourDate ) ; Year ( today ) ) )
] ;
Case ( 2 ≤ age and age < 4 ; YourDate )
)

DLake wrote:

I create 3 calcuation fields layer them on top of each other and format them in different colors.

It could be done with one calculation field using the TextColor() function.