Function order_query
This function allows the user to enter query criteria for the orders
table. It calls the function order_select
to retrieve the rows from the
database table.
Function
order_query
(orders.4gl):01
FUNCTION
order_query()
02
DEFINE
where_clause STRING
,
03
id INTEGER
, name STRING
04
05
MESSAGE
msg02
06
07
LET
int_flag = FALSE
08
CONSTRUCT BY NAME
where_clause ON
09
orders.store_num,
10
customer.store_name,
11
orders.order_num,
12
orders.order_date,
13
orders.fac_code
14
15
ON ACTION
zoom1
16
CALL
display_custlist() RETURNING
id, name
17
IF
id > 0 THEN
18
DISPLAY
id TO
orders.store_num
19
DISPLAY
name TO
customer.store_name
20
END IF
21
22
END CONSTRUCT
23
24
IF
(int_flag) THEN
25
LET
int_flag=FALSE
26
CLEAR FORM
27
MESSAGE
msg03
28
RETURN FALSE
29
END IF
30
31
RETURN
order_select(where_clause)
32
33
END FUNCTION
Note:
- Lines
08
thru22
TheCONSTRUCT
statement allows the user to query on specific fields, restricting the columns in theorders
table that can be used for query criteria. - Lines
15
thru20
handle thezoom1
action to let the user pick a customer from a list. The functiondisplay_custlist
is called, it returns the customer number and name. - Lines 24 through 29 check the value of the interrupt flag, and return
FALSE
if the user has interrupted the query. - Line
31
the query criteria stored in the variablewhere_clause
is passed to the functionorder_select
.TRUE
orFALSE
is returned from theorder_select
function.