January 15, 201114 yr 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"?
January 15, 201114 yr 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" )
January 18, 201114 yr Author 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"?
January 18, 201114 yr 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).
January 18, 201114 yr Author 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!
Create an account or sign in to comment