rokstedy Posted January 15, 2011 Posted January 15, 2011 I have a calculation using the position function to scan a field for certain verbiage. The calculation is exactly as follows: If ( Position ( ReportType; "URAR" or "multi" or "SFR" or "condo"; 1; 1) ≥ 1; "Full Report"; If( Position ( ReportType; "Desk"; 1; 1) ≥ 1; "Desk Review"; If (Position (ReportType; "Field"; 1;1) ≥ 1; "Field Review"; "Other"))) In my data, one of the possible field values is "Final Inspection - 1004D" that returns "Full Report" for the calculated field. Can anyone give me some idea how this is possible? Shouldn't it be an "Other"?
comment Posted January 15, 2011 Posted January 15, 2011 The expression: "URAR" or "multi" or "SFR" or "condo" evaluates to 0 (False), because none of the words are True. And since 0 does appear in "Final Inspection - 1004D"... Try something like = Case ( Position ( ReportType ; "URAR" ; 1 ; 1 ) or Position ( ReportType ; "multi" ; 1 ; 1 ) or Position ( ReportType ; "SFR" ; 1 ; 1 ) or Position ( ReportType ; "condo" ; 1 ; 1 ) ; "Full Report" ; Position ( ReportType ; "Desk" ; 1 ; 1 ) ; "Desk Review" ; Position ( ReportType ; "Field" ; 1 ; 1 ) ; "Field Review" ; "Other" )
rokstedy Posted January 18, 2011 Author Posted January 18, 2011 The expression: "URAR" or "multi" or "SFR" or "condo" evaluates to 0 (False), because none of the words are True. And since 0 does appear in "Final Inspection - 1004D"... say what? if I'm understanding correctly, because my result for my first test is 0 (zero), and 0 (zero) appears in my data, it's now TRUE...and thus "Full Report"?
comment Posted January 18, 2011 Posted January 18, 2011 No, not exactly. Your first test is: Position ( ReportType; "URAR" or "multi" or "SFR" or "condo"; 1; 1) ≥ 1 This test evaluates as True, that's why you are getting the first result - "Full Report". I was trying to explain why the test evaluates as True. To make a long story short, you cannot use "or" this way; you must place the "or" operators in-between STATEMENTS, not between ARGUMENTS. For example, this is correct: A = B or A = C but this: A = B or C makes C a statement on its own. The result will be true when A = B OR when C by itself evaluates as True (e.g. when C is a number other than zero).
rokstedy Posted January 18, 2011 Author Posted January 18, 2011 No, not exactly. Your first test is: Position ( ReportType; "URAR" or "multi" or "SFR" or "condo"; 1; 1) ≥ 1 This test evaluates as True, that's why you are getting the first result - "Full Report". I was trying to explain why the test evaluates as True. To make a long story short, you cannot use "or" this way; you must place the "or" operators in-between STATEMENTS, not between ARGUMENTS. For example, this is correct: A = B or A = C but this: A = B or C makes C a statement on its own. The result will be true when A = B OR when C by itself evaluates as True (e.g. when C is a number other than zero). I see what you mean. My mistake. Thank you!
Recommended Posts
This topic is 5116 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