July 2, 201213 yr 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
July 2, 201213 yr 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 ) ) ]
July 2, 201213 yr 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
July 2, 201213 yr Author 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!
July 2, 201213 yr 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.
Create an account or sign in to comment