John Chamberlain Posted May 19, 2015 Posted May 19, 2015 I have attached a simplified file with a calculated field that does not work. The calculated field is: Case (LeftWords (DISPOSITION;1 = "DIED") or LeftWords (DISPOSITION;1 = "EUTHANIZED") and IsEmpty(DATE OF DEATH); "DATE OF DEATH NOT ENTERED") I want the warning displayed if the disposition is either "DIED" or "EUTHANIZED" and the DATE OF DEATH field is empty. Thanks in advance. Untitled.fp7.zip
Kris M Posted May 19, 2015 Posted May 19, 2015 (edited) Don't have to be that complicated. If ( DISPOSITION = "DIED" or DISPOSITION = "EUTHANIZED" and IsEmpty ( DATE OF DEATH ); "DATE OF DEATH NOT ENTERED" ; "" ) What was your reasoning behind the choice of leftwords? Edited May 19, 2015 by Kris M
eos Posted May 19, 2015 Posted May 19, 2015 Don't have to be that complicated. Indeed, but one should still observe operator precedence: Case ( ( disposition = "died" or disposition = "euthanized" ) and IsEmpty ( dateOfDeath ) ; "Date of death not entered")
comment Posted May 19, 2015 Posted May 19, 2015 Case (LeftWords (DISPOSITION;1 = "DIED") or LeftWords (DISPOSITION;1 = "EUTHANIZED") and IsEmpty(DATE OF DEATH); "DATE OF DEATH NOT ENTERED") Problem #1: LeftWords (DISPOSITION;1 = "DIED") That's bad syntax. It should have been: LeftWords (DISPOSITION;1)= "DIED" The way you have it, it evaluates 1 = "DIED" first. This returns 0, and that's the number of words the LeftWords() function will return. Problem #2: AND is evaluated before OR. The way you have it (after fixing problem #1) will return the warning if the field begins with "DIED", regardless of the date being empty or not. Problem #3: The result type of the calculation should be Text.
comment Posted May 19, 2015 Posted May 19, 2015 If ( DISPOSITION = "DIED" or DISPOSITION = "EUTHANIZED" and IsEmpty ( DATE OF DEATH ); "DATE OF DEATH NOT ENTERED" ; "" ) Problem #2: - see above. BTW, an empty default result is entirely redundant.
Recommended Posts
This topic is 3812 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