Project

General

Profile

crle-compound3-find-where.p

Stanislav Lomany, 08/14/2019 04:07 PM

Download (1.06 KB)

 
1
define temp-table tt1 field f1 as integer index idx1 is primary f1.
2
define temp-table tt2 field f2 as integer index idx2 is primary f2.
3
define temp-table tt3 field f3 as integer index idx3 is primary f3.
4

    
5
create tt1. tt1.f1 = 1.
6
create tt1. tt1.f1 = 2.
7
create tt1. tt1.f1 = 3.
8
create tt1. tt1.f1 = 4.
9

    
10
create tt2. tt2.f2 = 1.
11
create tt2. tt2.f2 = 2.
12
create tt2. tt2.f2 = 3.
13
create tt2. tt2.f2 = 4.
14

    
15
create tt3. tt3.f3 = 1.
16
create tt3. tt3.f3 = 2.
17
create tt3. tt3.f3 = 3.
18
create tt3. tt3.f3 = 4.
19

    
20

    
21
def query q for tt1, tt2, tt3 scrolling.
22
open query q for each tt1, each tt2, each tt3 where tt3.f3 <> tt2.f2 or tt3.f3 <> tt1.f1.
23

    
24
def var cnt as integer.
25
repeat:
26
   cnt = cnt + 1.
27
   query q:get-next().
28
   
29
   if cnt = 5 then do:
30
      find tt1 where tt1.f1 = 3.
31
      find tt2 where tt2.f2 = 3.
32
      find tt3 where tt3.f3 = 4.
33
      query q:create-result-list-entry().
34
      leave. 
35
   end.  
36
end.
37

    
38
output to crle-compound3-find-where.txt.
39
query q:get-first().
40
repeat:
41
   if not avail(tt1) then leave.
42
   
43
   message tt1.f1 tt2.f2 tt3.f3.
44
   query q:get-next().
45
end.
46
output close.