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 4893 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted

I have created a field called Current Semester with the following calculation:

If (Get ( CurrentDate ) ≥ Date ( 7 ; 1 ; Year ( Get ( CurrentDate ) )) and Get ( CurrentDate ) ≤ Date ( 12 ; 31 ; Year ( Get ( CurrentDate ) ) ); "First"; If (Get ( CurrentDate ) ≥ Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) )) and Get ( CurrentDate ) ≤ Date ( 6 ; 30 ; Year ( Get ( CurrentDate ) ) ); "Second";""))

My computer clock is set at 8/28/2011. Of my 519 records, 20 say "First" and the rest say "Second". i do not understand why all the records do not say "First".

Thanks for any light!!

Rachael

Posted

I will re-write your expression to be a bit easier to read:


If (

Get ( CurrentDate ) >= Date ( 7 ; 1 ; Year ( Get ( CurrentDate ) ) ) and

Get ( CurrentDate ) <= Date ( 12 ; 31 ; Year ( Get ( CurrentDate ) ) ) ;

"First";

 

If (Get ( CurrentDate ) >= Date ( 1 ; 1 ; Year ( Get ( CurrentDate ) ) ) and

Get ( CurrentDate ) <= Date ( 6 ; 30 ; Year ( Get ( CurrentDate ) ) ) ; "Second" ;

 

""

)

)



 

 

It seems that you are saying:

 

if date is between 1 July and 31 December then return "First" else

if date is between 1 January and 30 June then return "Second"

 

Much better to use the Case function instead of nested IFs. Also consider that the result should be "Second" if it's not "First...

 

 



Case (

 

Get ( CurrentDate ) >= Date ( 7 ; 1 ; Year ( Get ( CurrentDate ) ) ) and

Get ( CurrentDate ) <= Date ( 12 ; 31 ; Year ( Get ( CurrentDate ) ) ) ;

"First";

 

"Second"

)



 

EDIT: Actually you could probably do away with the "<=31 December" expression too.

 

 



Case (

 

Get ( CurrentDate ) >= Date ( 7 ; 1 ; Year ( Get ( CurrentDate ) ) ) ;

"First";

 

"Second"

 

)

Also: make sure the calculation is set to be UNSTORED.

Posted

Actually, Rachael's calculation works so lack of updating was probably due to not checking 'Do not store calculation results' in the Storage Options so it will update. But I'm glad she posted so she could get some better calc examples and an explanation from Vaughan. :yep:

This topic is 4893 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.