1

I need help writing this progress query: find first a no-lock where a.a = variable and a.b = variable2 and a.c = variable3 and ((a.d <> variable4 and a.e <> variable5 and a.f <> variable6) /* this "or in" is just sudecode for what I want it to do */ or in (first b no-lock where b.a = variable and (b.b = variable7 or b.b = variable8 no-error))) no-error.`

The "or in" is the thing I'm having trouble with.

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
Bill
  • 1,237
  • 4
  • 21
  • 44
  • You'll have to describe more precisely what you mean by 'or in'. Either way, you're trying to find the first table entry of table 'a' with a where-clause, but i don't get the reference to table 'b'. What's supposed to be 'in'? – LyrixDeRaven Feb 29 '12 at 14:48
  • I want to check if a.d <> variable... OR there is an item returned from the second statement. – Bill Feb 29 '12 at 15:02

3 Answers3

2

Given the kind of statement you want to create, I suggest the following two-step process:

find first b no-lock where b.a = variable 
                           and (b.b = variable7 or b.b = variable8) no-error.

find first a no-lock where a.a = variable 
                           and a.b = variable2 
                           and a.c = variable3 
                           and ((a.d <> variable4 and a.e <> variable5 and a.f <> variable6) 
                                 or available b) 
             no-error.
LyrixDeRaven
  • 538
  • 3
  • 9
  • I believe that you will find that: where b.a = v1 and ( b.b = v7 or b.b = v8 ) is more efficient if written as: where ( b.a = v1 and b.b = v7 ) or ( b.a = v1 and b.b = v8 ) – Tom Bascom Mar 01 '12 at 22:35
0

Don't think too much it like MS SQL query or the general scripting query.

like for each test1 no-lock where test1.a = var1 and test1.b = var2 no-error.

same as find first test1 no-lock where test1.a = var1 and (test1.b = var2 or test1.c = var3) no-error. // it gives you only one row at a time.

0

I believe the statement you are looking for is 'can-find'.

... or can-find(first b where b.a = a.a ...
Sander
  • 1
  • 1