Jump to content

Position function results


This topic is 4818 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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"?

Link to comment
Share on other sites

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"

)

Link to comment
Share on other sites

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"?

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

This topic is 4818 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.