2

I'm having a problem with Progress, our usual programmer for this is out for the holidays and I have no real knowledge of the system. I need to get a list of Branches that are not one of these codes ["AXD","BOD","CLA","CNA","CTS","NOB","OFF","ONA","PRJ","WVL"].

I tried for each removals where r-brchdisplay not(matches ["AXD","BOD","CLA","CNA","CTS","NOB","OFF","ONA","PRJ","WVL"]). display rpid.

but that syntax is obviously wrong. Thanks

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
Jesse
  • 27
  • 7

1 Answers1

2

The square brackets are not a correct part of the syntax.

Matches matches one string against another -- not a set of options. I.e.

not ( r-brchdisplay matches "axd" or r-brchdisplay matches "bod" or ... )

Using MATCHES is also kind of silly since these are equality comparisons without wild-cards. MATCHES is typically used when wild-cards are involved.

MATCHES is also generally a very, very bad idea in a WHERE clause as it all but guarantees a table scan.

Alternative ways to write your WHERE clause:

not ( r-brchdisplay = "axd" or r-brchdisplay = "bod" or ... )

or

r-brchdisplay <> "axd" and r-brchdisplay <> "bod" and ...

LOOKUP() much is closer to what you probably need:

for each removals no-lock where
  lookup( r-brchdisplay, "axd,bod,cla,cna,cts,nob,off,ona,prj,wvl" ) = 0:
  /* do something... */
end.

(The "= 0 " means that LOOKUP did NOT find the target string...)

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33