Newbies Rachael Posted August 29, 2011 Newbies Posted August 29, 2011 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
Vaughan Posted August 29, 2011 Posted August 29, 2011 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.
comment Posted August 29, 2011 Posted August 29, 2011 How about = Case ( Month ( Get ( CurrentDate ) ) ≥ 7 ; "First" ; "Second" )
LaRetta Posted August 29, 2011 Posted August 29, 2011 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:
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now