Re: ON KEY with EXIT INPUT: loosing field data (fwd)
Posted in 1995
Topics: Error Codes & Troubleshooting, Server Administration
[deletia]
>
> > However, I have run into the problem described in the INPUT manual page.
> > The ON KEY command expects to return to the current field. Because my
> > ON KEY contains an EXIT INPUT statement, any data changes in the current
> > field are discarded when the EXIT INPUT is done.
>
[deletia]
>
> This is a really good question. I've also had this problem which I let
> the users get used to.
>
> Someone must have a good solution!
Here is the solution we used to get around the EXIT INPUT problem,
even though we now use 4.1 we still continue to use this method as it
is effective and works. ie. if it ain't broke etc.
LET xint = 0
INPUT acct_rec.asset,
acct_rec.descr WITHOUT DEFAULTS
FROM acct_frm.asset,
acct_frm.descr
BEFORE FIELD acct_frm.asset
CASE
WHEN xint = 1 {quit}
EXIT INPUT
WHEN xint = 2 {accept}
EXIT INPUT
END CASE
NEXT FIELD acct_frm.descr
# AFTER FIELD acct_frm.asset
# BEFORE FIELD acct_frm.descr
# AFTER FIELD acct_frm.descr
ON KEY (F3,ESCAPE) {cancel}
LET sysmsgs = "Insert cancelled at user request."
CALL sys_msgbox( " " )
# Signify quit and jump to key field.
LET xint = 1
NEXT FIELD acct_frm.asset
AFTER INPUT {accept alias ON KEY (F9,INTERRUPT)}
# Signify accept and jump to key field.
LET xint = 2
NEXT FIELD acct_frm.asset
END INPUT
IF xint = 2 THEN
WHENEVER ERROR CONTINUE
INSERT INTO ASSET_TABLE
(
ASSET_TYPE,
ASSET_DESC
) VALUES (
acct_rec.asset,
acct_rec.descr
)
WHENEVER ERROR STOP
CASE
WHEN SQLCA.SQLCODE = 0
LET sysmsgs = "Asset '",acct_rec.asset,"' inserted."
CALL sys_msgbox( " " )
OTHERWISE
LET sysmsgs = "Asset '",acct_rec.asset,"' NOT inserted."
CALL sys_msgbox( "E" )
END CASE
END IF
Cheers, Ian.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ian Timms (DBA/Administrator) % Disclaimer: All opinions expressed %
% itimms@vprp333q.prop.telecom.com.au % herein are mine and mine alone! %
% Ph. 61+3+634-9144 % ==__( pretty piccy goes here )__== %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%