Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 5883 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi. I was wondering if someone could help with a question I have. I'm trying to do a calculation that needs to find a range of dates. If the date is between 1-1-2009 and 3-31-2009 then it needs to return a statement like "1-1-2009 through 3-31-2009" and then the if statement has to continue and do the same for April -Jun, Jul-Sept, and October-December. I've tried it, but everyting I try always ends up returning everything after 1-1-2009. Any help would be greatly appreciated.

Posted

Case(

YourDateField ≤ Date ( 12 ; 31 ; 2008 ) ; "" ;

YourDateField ≤ Date ( 3 ; 31 ; 2009 ) ; "1-1-2009 through 3-31-2009" ;

YourDateField ≤ Date ( 6 ; 30 ; 2009 ) ; "4-1-2009 through 6-30-2009" ;

YourDateField ≤ Date ( 9 ; 30 ; 2009 ) ; "7-1-2009 through 9-30-2009" ;

YourDateField ≤ Date ( 12 ; 31 ; 2009 ) ; "10-1-2009 through 12-31-2009"

)

Posted

If I understand this correctly, you don't need an if statement:


Let ( [

m = Month ( YourDate ) ;

y = Year ( YourDate )

] ;

Date ( 3 *  Div ( m - 1 ; 3 ) + 1 ; 1 ; y )

& " through " &

Date ( 3 *  Div ( m - 1 ; 3 ) + 4 ; 0 ; y )

)

Posted (edited)

What if y < 2009 or y > 2009 ?

Simply wrap Comment's calc with an If() or Case () like:

[color:green]If ( Year ( YourDate ) = 2009 ;

Let ( [

m = Month ( YourDate ) ;

y = Year ( YourDate )

] ;

Date ( 3 * Div ( m - 1 ; 3 ) + 1 ; 1 ; y )

& " through " &

Date ( 3 * Div ( m - 1 ; 3 ) + 4 ; 0 ; y )

)

[color:green])

But it doesn't make much sense to limit the calc when it would automatically work whenever, whereever one would want it to, whenever viewed. It is obviously a calc for display purposes only.

Michael - I didn't mean to alter your calc which is perfect as it stands. I just wanted to produce an example of how; also indicating it wouldn't be necessary (from what I can tell).

Edited by Guest
Added sentence
Posted

We build to last. :B

Now, seriously: if someone wanted a calculation that only returns a result for 2009, I would tell them to rethink their strategy. Because "2009" is data - and it doesn't belong in a calculation formula, which is part of the schema.

This topic is 5883 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.