query-entry-mult.p
1 |
def temp-table tt1 field f1 as integer |
---|---|
2 |
field f2 as integer. |
3 |
|
4 |
def temp-table tt2 field f3 as integer. |
5 |
|
6 |
def var i as integer. |
7 |
repeat i = 1 to 10: |
8 |
create tt1. tt1.f1 = i. |
9 |
end. |
10 |
|
11 |
repeat i = 20 to 30: |
12 |
create tt1. tt1.f1 = i. |
13 |
end. |
14 |
|
15 |
create tt2. tt2.f3 = 1. |
16 |
|
17 |
def query q for tt1, tt2 scrolling. |
18 |
open query q for each tt1, each tt2. |
19 |
|
20 |
def var h as handle. |
21 |
h = query q:handle. |
22 |
|
23 |
h:get-first(). |
24 |
h:get-next(). |
25 |
h:get-next(). |
26 |
h:get-next(). |
27 |
|
28 |
create tt1. tt1.f1 = 15. |
29 |
create tt2. tt2.f3 = 2. |
30 |
h:create-result-list-entry(). |
31 |
|
32 |
find first tt1 where tt1.f1 = 25. |
33 |
release tt2. |
34 |
h:create-result-list-entry(). |
35 |
|
36 |
release tt1. |
37 |
h:create-result-list-entry(). |
38 |
|
39 |
h:get-next(). |
40 |
def var ch as char. |
41 |
ch = if not avail(tt1) then "N/A" else string(tt1.f1). |
42 |
ch = ch + " " + (if not avail(tt2) then "N/A" else string(tt2.f3)). |
43 |
message "after: " ch. |
44 |
|
45 |
def var res as logical. |
46 |
res = h:get-first(). |
47 |
repeat while res: |
48 |
|
49 |
ch = if not avail(tt1) then "N/A" else string(tt1.f1). |
50 |
ch = ch + " " + (if not avail(tt2) then "N/A" else string(tt2.f3)). |
51 |
message ch. |
52 |
res = h:get-next(). |
53 |
end. |