>Why does this code erase all the locations when it should only remove those not in the scan line of code?
>
>Scan For Alltrim(crimetype) <> "B&E Cabin" OR Alltrim(crimetype) <> "B&E Home" ;
OR Alltrim(crimetype) <> "B&E Business" OR Alltrim(crimetype) <> "B&E Garage"
> ShapeID = localcrime1.shapename
> Thisform.RemoveObject(ShapeID)
>Endscan
>
Grady,
That expression would always return .t..
c = "hello"
if m.c <> 'hello' or m.c <> 'there'
if m.c <> 'there' or m.c <> 'hello'
I think you meant AND instead.
While you can fix it by replacing ORs with ANDs, or surrounding all of them with parentheses and having NOT. ie:
c = "hello"
if !(m.c <> 'hello' or m.c <> 'there')
if !(m.c <> 'there' or m.c <> 'hello')
it gets more and more ugly as your checklist have more elements. One way is to use inlist(), however that too is limited (25 according to documentation). Also there would be casing issue with that. Another approach would be using ascan(). ie:
ALINES(aExclude,"B&E Cabin,B&E Home,B&E Business,B&E Garage",1,',')
scan for ascan(aExclude,alltrim(crimetype),1,-1,1,7)=0
endscan
Cetin