aharown07 Posted January 5, 2006 Posted January 5, 2006 I've had alot of trouble getting a compound IF function to work... in fact, I've never gotten one to work. Here's my latest effort. Can't figure out what I'm doing wrong. If(LocCurrentRez::Apartment ≠ "n/a" or LocCurrentRez::Apartment ≠ "";"Apt: "&LocCurrentRez::Apartment;" ") This occurs in the middle of a long calculation that concatinates a bunch of stuff into a giant global text field. Everything works, except the lines "OR" in them. These work in the case of whatever condition I put first, but not what I put second. The example is supposed to put " " in the field whenever LocCurrentRez::Apartment contains either nothing or "n/a" As it is, it will put " " in the field for "n/a" but not for "". So I'm guessing that there is something wrong w/how I'm using "OR" Can't seem to find enough examples of the proper use of "OR" in functions to get the syntax clear in my head.
Zero Tolerence Posted January 5, 2006 Posted January 5, 2006 If( isEmpty(LocCurrentRez::Apartment) or LocCurrentRez::Apartment = "n/a"; " "; LocCurrentRez::Apartment) That should work, if it doesn't there could be a problem with your relationship.
Lee Smith Posted January 5, 2006 Posted January 5, 2006 I prefer the case statement, for me they are easier to read, write and explain. Case(LocCurrentRez::Apartment = "n/a"; " "; IsEmpty(LocCurrentRez::Apartment ); " "; "Apt: "& LocCurrentRez::Apartment) Lee
SlimJim Posted January 5, 2006 Posted January 5, 2006 The or in your quote always evaluates to true (the first statement is true unless LocCurrentRes::Apartment = n/a and then the second statenent is true since n/a is not empty). The problem is in the use of not equal. In order to achieve your aim using "not equal" you must replace the or by and. Alternatively replace the not equal by equal and invert the order of the last two items of the If.
aharown07 Posted January 5, 2006 Author Posted January 5, 2006 Well, I'm still having a hard time getting my mind wrapped around it, but I do see that I have overlapping conditions... "anything but n/a" and "anything but empty" Somehow it feels like these conditions should work sort of cumulatively with "or" but I guess not. Anyway, it looks like I've got a couple of good alternatives here. THanks.
aharown07 Posted January 5, 2006 Author Posted January 5, 2006 Ah! I believe I get it. If the value is "n/a" it is also not empty so it calculates to the true result. Double negatives are just a bad idea for brains like mine!
Recommended Posts
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