pjohns
28th January 2004, 17:58
Hello,

I have a exchange scheme which I've created a condition for. Below I have attached the script below.I'm trying to exclude warehouses from my selection. This logic doesn't appear to be working. Could somebody please help me with the correct syntax?

table ttdinv001
table ttdltc001

domain tcstoc onhand

onhand = 0

select tdinv001.item, tdinv001.stoc
from tdinv001
where tdinv001.item = :tiitm001.item
and (tdinv001.cwar <> "5MC" or tdinv001.cwar <> "911"
or tdinv001.cwar <> "921" or tdinv001.cwar <> "2SD" or
tdinv001.cwar <> "2AM" or tdinv001.cwar <> "3IB" or
tdinv001.cwar <> "71R" or tdinv001.cwar <> "711" or
tdinv001.cwar <> "1IR")
selectdo

onhand = onhand + tdinv001.stoc - tdinv001.allo

endselect

return(onhand)

Thanks

PJ

gfasbender
28th January 2004, 18:14
Use and(s) not or(s)

where tdinv001.item = :tiitm001.item
and tdinv001.cwar <> "5MC"
and tdinv001.cwar <> "911"
and tdinv001.cwar <> "921"
and tdinv001.cwar <> "2SD"
and tdinv001.cwar <> "2AM"
and tdinv001.cwar <> "3IB"
and tdinv001.cwar <> "71R"
and tdinv001.cwar <> "711"
and tdinv001.cwar <> "1IR"

or, you could use:

where tdinv001.item = :tiitm001.item
and not
(tdinv001.cwar ="5MC"
or tdinv001.cwar ="911"
or tdinv001.cwar ="921"
or tdinv001.cwar ="2SD"
or tdinv001.cwar ="2AM"
or tdinv001.cwar ="3IB"
or tdinv001.cwar ="71R"
or tdinv001.cwar ="711"
or tdinv001.cwar ="1IR")

kbartelds
28th January 2004, 18:15
Hi,

better to select all field (tdinv001.*). If you want to exclude the named cwar's, try to use and instead of or.

Best regards,
Klaas