0% found this document useful (0 votes)
26 views20 pages

OpenEdge 4GL Query Concepts (FOR EACH, FIND, GET, INDEX)

The document discusses OpenEdge 4GL query concepts, specifically focusing on the use of FOR EACH, FIND, GET, and INDEX commands. It provides various examples of how to query customer data using different conditions and indexing methods. The content is aimed at helping users understand how to effectively retrieve and manipulate data within the OpenEdge environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views20 pages

OpenEdge 4GL Query Concepts (FOR EACH, FIND, GET, INDEX)

The document discusses OpenEdge 4GL query concepts, specifically focusing on the use of FOR EACH, FIND, GET, and INDEX commands. It provides various examples of how to query customer data using different conditions and indexing methods. The content is aimed at helping users understand how to effectively retrieve and manipulate data within the OpenEdge environment.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.

com/s/article/000012195

OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX)

OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX)

25-Jul-2013 • Knowledge

1 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

2 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

3 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

(name BEGINS "M")

((name > "Off The Wall") and (name < "Quick Toss Lacrosse"))

4 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

for each customer: /* entire table desired, no where clause */


end.

for each customer by state: /* sort, no index on state */


end.

for each customer where (state = "OH"): /* no index on state */


end.

for each customer where (zip = 12345):


end.

for each customer where (name = "Off The Wall"):


end.

for each customer where (name begins "B"):


end.

for each customer where (zip > 50000) and (zip < 60000):
end.

for each customer where (name = "Off The Wall") and (zip > 50000):
end.

for each customer where (cust-num <= 10) or (name = "Mary"):


end.

for each customer where (zip = 12345) or (zip > 40000):


end.

for each customer where ((zip > 50000) and (zip < 60000)) or ((zip > 70000) and (zip <
80000)):
end.

5 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

for each customer where (name = "Off The Wall") or (zip = 17030) or (name = "StickyWicket
Cricket"):
end.

for each customer


where ((name = "Off The Wall") and (zip = 01824)) or
((name = "StickyWicket Cricket") and (zip = 22070)):
end.

for each customer


where (cust-num < 10) and (city = "Boston"):
end.

6 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

for each claim


where (description contains "lawyer | attorney"):
end.

find customer where (rowid(customer) = <some rowid value>)

find customer where (city = "Boston")

7 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

do preselect each customer: /* client asks for rowids only */


... /* in full messages */
end.

for each customer no-lock: /* client asks for multiple records */


... /* per message if possible */
end.

8 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

define query q for customer scrolling.


open query q preselect each customer.

/* the next statement will simply reposition the query within */


/* the result list */

reposition q to row 3.

/* the next statement will read customer 3 via its rowid */


/* stored in the result list */

get next q.

define query q for customer scrolling.


open query q for each customer indexed-reposition.

find customer where ... xxx = rowid(customer).

/* the next statement will cause the serve to reposition the */


/* index cursor used by the query */

reposition q to rowid xxx.

9 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

define query q for customer cache 10.


open query q for each customer no-lock.
get next q. /* gets cust 1 */
get next q. /* gets cust 2, leaves cust 1 in the cache */
get prev q. /* gets cust 1 from cache without access to */
/* database or server */

define variable iCount as INTEGER NO-UNDO.


define query qCust for Customer.

Open query qCust for each Customer.


GET FIRST qCust.

DO WHILE AVAILABLE Customer:


iCount = iCount + 1.
GET NEXT qCust.
END.
Display iCount.
CLOSE QUERY qCust.

define input parameter bufHandle as HANDLE.


define input parameter qryString as CHARACTER.
define variable hQuery as HANDLE NO-UNDO.

CREATE QUERY hQuery.


hQuery:SET-BUFFERS(bufHandle).
hQuery:QUERY-PREPARE(qryString).
hQuery:QUERY:OPEN().

10 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

for each customer


where ((cust-num <= 10) and (city = "Boston")) or (zip > 01824):
end.

11 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

12 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

i = 5.
for each customer where (cust-num > i):
display cust-num.
i = 1.
end.

13 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

do preselect each customer: /* prepares complete result list */


find next customer. /* gets rowid from list, reads rec*/
find last customer. /* gets last rowid from list, */
/* reads record */
end.

14 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

find first customer where (cust-num > 10) use-index cust-num

find next customer where (name = "Mary") use-index cust-num

find prev customer where (cust-num < 100)

15 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

find first customer where (name = "chip")

find next customer where (cust-num > 0)

display cust-num name

i = 5.
repeat:
find next customer where (cust-num > i):
display cust-num.
i = 53.
end.

16 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

17 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

i = 5.
open query q for each customer where (cust-num > i).
get next q.
display cust-num.
i = 1.
get next q.
display cust-num.

18 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

Files (0) (/s/relatedlist/ka74Q000000TTZlQAO/AttachedContentDocuments)

19 of 20 02/02/2024, 21:45
OpenEdge 4GL Query concepts (FOR EACH, FIND, GET, INDEX) - P... https://community.progress.com/s/article/000012195

Was this article helpful?

Related Articles

(https://www.progress.com/)

(https://www.facebook.com/progresssw) (https://twitter.com/progresssw)
(https://www.youtube.com/user/ProgressSW) (https://www.linkedin.com/company/progress-software)

DO NOT SELL MY PERSONAL INFO (HTTPS://FORMS.PROGRESS.COM/CCPA-SUBSCRIPTION)

20 of 20 02/02/2024, 21:45

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy