Help ....
Posted in 1996
Topics: Stored Procedures & SPL
Hello world,
I need some help. What I am tring to do is this:
after the CALL query() funtion has completed successfully
I want to allow the user to bring up a window with some
more data for browsing. What is the best way to do this?
The function you see called PSCREEN() is supposed to
handle this task. I just need a way to assign a KEY
that the user can press so that I can call the function.
I am stumped.
Thanks in advance
Leon.
CALL prepare_cur()
MENU "OPTIONS"
COMMAND "Query" "Search for employer file data"
CALL query()
LET ans ="y"
WHILE ans ="y"
IF
COMMAND "Next" "View the next employer file data in the list"
CALL query_next()
COMMAND "Previous" "View the previous employer file data in the list"
CALL query_previous()
COMMAND "First" "View the first employer file data in the list"
CALL query_first()
COMMAND "Last" "View the last employer file data in the list"
CALL query_last()
COMMAND "Update" "Update employer file data"
CALL update()
#COMMAND "Screen" "Goto Parent Screen."
# CALL pscreen()
COMMAND "Exit" "Exit to FILE MAINTENANCE menu"
CLEAR SCREEN
DISPLAY "Program end run..." AT 1,1
EXIT MENU
END MENU
END MAIN
FUNCTION pscreen() { parent screen }
-- what the heck is supposed to happen here?
CLEAR SCREEN
OPEN WINDOW wParent
AT 1,1 WITH
FORM "c1_1_2"
ATTRIBUTE (bold)
#CURRENT WINDOW wParent
#CLEAR WINDOW wParent
#OPEN FORM f_c1_1_2 FROM "c1_1_2"
#DISPLAY FORM f_c1_1_2
SELECT
vio_type, parent_name, parent_adres1, parent_adres2,
parent_city, parent_st, parent_zip,
parent_phone
FROM case
WHERE p_case.case_no = case.case_no
DISPLAY p_case.case_no, p_case.ein, p_case.vio_type,
p_case.trade_name, p_case.p_name,
p_case.p_adres1, p_case.p_adres2,
p_case.p_city,
p_case.p_st, p_case.p_zip,
p_case.p_phone, p_case.p_ein to sc_head.*
sleep 6
END FUNCTION {pscreen() }
FUNCTION query()
DEFINE l_where CHAR(250)
DEFINE l_query_head CHAR(300)
CLEAR FORM
DISPLAY
"QUERY: <CTRL-C> Cancel, <CTRL-[> or ESC To Query", "" AT 1,1
CONSTRUCT BY NAME l_where ON case.case_no, case.ein, case.trade_name,
case.est_adres1, case.est_adres2,
case.est_city, case.est_st, case.est_zip,
case.contct_name, case.contct_phone,
case.contct_title
{If the user interrupted the query (CTRL-C), return back to the menu}
IF INT_FLAG THEN
LET int_flag = FALSE
MESSAGE "Query canceled."
SLEEP 3
MESSAGE ""
LET next_opt = "0"
RETURN next_opt
END IF
MESSAGE "Searching..."
LET l_query_head = "SELECT case.case_no, case.ein, case.trade_name, ",
"case.est_adres1, ",
"case.est_adres2, case.est_city, case.est_st, ",
"case.est_zip, case.contct_name, ",
"case.contct_phone, ",
"case.contct_title ",
"FROM case ",
"WHERE ",l_where CLIPPED ,
"ORDER BY case.case_no"
PREPARE q_st1 FROM l_query_head
DECLARE q_cur1 SCROLL CURSOR WITH HOLD for q_st1
OPEN q_cur1
#CLOSE WINDOW search_msg
DISPLAY "" at 24,1
FETCH FIRST q_cur1 INTO p_case.*
#DISPLAY BY NAME p_case.*
DISPLAY p_case.case_no THRU p_case.contct_fax to sc_cust1.*
CALL display_screen()
DISPLAY "Preparing to return after query..." at 24,1
sleep 5
LET next_opt = "1"
RETURN next_opt
END FUNCTION
FUNCTION display_screen ()
MESSAGE "Press Control-B for Parent Screen." ATTRIBUTE (REVERSE)
CALL prepare_screen()
DISPLAY p_case.case_no THRU p_case.contct_fax to sc_cust1.*
#DISPLAY BY NAME p_case.*
RETURN
END FUNCTION
FUNCTION prepare_screen()
OPEN t_quy_cur USING p_case.case_no
FETCH t_quy_cur INTO p_case.*
SELECT ein, trade_name, est_adres1, est_adres2,
est_city, est_st,
est_zip, contct_name, contct_phone, contct_title
parent_adres1, parent_adres2,
parent_city, parent_city, parent_st, parent_zip,
parent_phone
INTO p_case.ein, p_case.trade_name,
p_case.est_adres1,
p_case.est_adres2, p_case.est_city, p_case.est_st,
p_case.est_zip, p_case.contct_name, p_case.contct_phone,
p_case.contct_title, p_case.p_name,
p_case.p_adres1, p_case.p_adres2,
p_case.p_city, p_case.p_city,
p_case.p_st, p_case.p_zip,
p_case.p_phone
FROM case
WHERE case_no = p_case.case_no
END FUNCTION