Function order_select

This function creates the SQL statement for the query and the corresponding cursor to retrieve the rows from the orders table. It calls the function fetch_order.

Function order_select (orders.4gl):
01 FUNCTION order_select(where_clause) 
02   DEFINE where_clause STRING,   
03          sql_text STRING   
04        
05   LET sql_text = "SELECT "
05       || "orders.store_num, "
06       || "customer.store_name, "
07       || "orders.order_num, "
08       || "orders.order_date, "
09       || "orders.fac_code, "
10       || "orders.ship_instr, "
11       || "orders.promo "
12       || "FROM orders, customer "
13       || "WHERE orders.store_num = customer.store_num "
14       || "AND " || where_clause 
15  
16   DECLARE order_curs SCROLL CURSOR FROM sql_text  
17   OPEN order_curs 
18   IF (NOT order_fetch(1)) THEN
19      CLEAR FORM
20      MESSAGE msg04
21      RETURN FALSE
22   END IF
23  
24   RETURN TRUE
25  
26 END FUNCTION
Note: