August 29, 201114 yr Newbies 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
August 29, 201114 yr 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.
August 29, 201114 yr 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:
Create an account or sign in to comment