Announcement

Collapse
No announcement yet.

IF with AND / OR not doing as I expect...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    IF with AND / OR not doing as I expect...

    UPDATE - RESOLVED

    I figured out that I missed CASE ... so I had 1 letter the wrong case and it was missing it.


    For some reason it is not 'excluding' the Devices with the Loction2 text that I'm specifying.

    IF needs to...

    'include' devices when Names match strDevName
    and
    'exclude' devices that match excludeL2 & L2_2

    Code:
    Const Lock_excludeL2 = "Plug-Ins"        
    Const Door_excludeL2 = "Plug-Ins"            
    Const Motion_excludeL2 = "Plug-Ins"    
    Const Window_excludeL2 = "Plug-Ins"
    Const Lock_excludeL2_2 = "Security"        
    Const Door_excludeL2_2 = "Security"            
    Const Motion_excludeL2_2 = "Security"    
    Const Window_excludeL2_2 = "Security"
    Code:
                intDevRef = objDevice.Ref(hs)
                strDevName = objDevice.Name(hs)
                strDevLoc = objDevice.Location(hs)
                strDevLoc2 = objDevice.Location2(hs)
                dblDevValue = hs.DeviceValueEx(intDevRef)
                strDevString = hs.DeviceString(intDevRef)
                If Instr(strDevName,Lock_sNAME) > 0 and (strDevLoc2 <> Lock_excludeL2 and strDevLoc2 <> Lock_excludeL2_2) Then    ' LOCKS
    Last edited by Ltek; July 15, 2017, 02:34 PM.
Working...
X