Michelle Logan Posted July 2, 2012 Posted July 2, 2012 We have a special needs class that has special services provided. These services are povided on a "Service Date". I need to set another field based on the year of the Service Date (which is displayed as a normal date 7/1/2012), I have tried If [service Date= Year(Get(CurrentDate)] Set Field [unit Count; Service Units] but nothing happens. I thought this would check the Service Date field against the current Date/Year and if the year was part of the Service Date then the field would be set. But it does not work. Can someone assist? Thank you, Michelle
eos Posted July 2, 2012 Posted July 2, 2012 The expression in If [] compares a date ( Service Date) with a number ( Year ( Get ( CurrentDate ) ). Instead, compare two numbers - the year of Service Date and the current year: If [ Year ( Service Date ) = Year ( Get ( CurrentDate ) ) ]
doughemi Posted July 2, 2012 Posted July 2, 2012 If Unit Count is a calculation field ( or a number field with an auto-entered calculation), the correct syntax for the calculation is If(Year(Service Date) = Year(get(CurrentDate)); ServiceUnits) If this is a part of a script, the correct syntax is If[Year(Service Date) = Year(get(CurrentDate))] Set Field [unit Count; Service Units] End if
Michelle Logan Posted July 2, 2012 Author Posted July 2, 2012 Thank you both very much, It is now very clear I finally gave up last night around midnight. Thanks again for all the help. I am off to make a dontation to the FMForums Tip Jar!
comment Posted July 2, 2012 Posted July 2, 2012 You posted this in the calculation section, yet you are using a script syntax. Be aware of the difference. The current year is something that changes every January 1st. A calculation field - provided it's unstored - will evaluate anew on every screen refresh. Setting the field by script will store the result and leave it as is until you run the script again.
Recommended Posts
This topic is 4585 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