Home » Developer & Programmer » Forms » WHEN-BUTTON-PRESSED event issue (Forms [32 Bit] Version 11.1.2.2.0 (Production))
WHEN-BUTTON-PRESSED event issue [message #685112] Mon, 25 October 2021 21:59 Go to next message
andycheng884
Messages: 3
Registered: October 2021
Junior Member
Hi Expert,

I would like to create the oracle forms with create record in DB table. I use the call procedure in oracle forms use but I try to run in oracle forms does not work. When I insert new record in text item (oracle Forms), the button event will show all messages. (In DB to run the procedure, the result is normal.)

May I know the my condition which part is wrong?

Thanks,
Andy

----------------------------------------------------------------------------

Oracle forms (WHEN-BUTTON-PRESSED)

DECLARE

O_ERR_MSG nvarchar2 (500);
L_SUCCESS BOOLEAN;
v_count number;

BEGIN

SELECT count (*)
INTO v_count
FROM CMX_OFIN_LOC_MAPPING
WHERE company = :CREATE_BLOCK.COMPANY
AND NEO_LOC = :CREATE_BLOCK.NEO_LOC
AND OFIN_LOC = :CREATE_BLOCK.OFIN_LOC
AND OFIN_COMP = :CREATE_BLOCK.OFIN_COMP
AND OCC = :CREATE_BLOCK.OCC
AND segment12 = :CREATE_BLOCK.SEGMENT12_MAP
AND BRAND_CODE_IN = :CREATE_BLOCK.BRAND_CODE
;

IF (:CREATE_BLOCK.COMPANY IS NOT NULL AND
:CREATE_BLOCK.NEO_LOC IS NOT NULL AND
:CREATE_BLOCK.OFIN_LOC IS NOT NULL AND
:CREATE_BLOCK.OCC IS NOT NULL AND
:CREATE_BLOCK.SEGMENT12_MAP IS NOT NULL AND
:CREATE_BLOCK.BRAND_CODE IS NOT NULL) AND v_count < 1 THEN

L_SUCCESS := cmx_OFIN_MAP_UTILITY.CMX_LOC_IUD (:CREATE_BLOCK.COMPANY,
'CMX_OFIN_LOC_MAPPING' ,
'I',
:CREATE_BLOCK.NEO_LOC,
:CREATE_BLOCK.OFIN_LOC,
:CREATE_BLOCK.OFIN_COMP,
:CREATE_BLOCK.OCC,
:CREATE_BLOCK.SEGMENT12_MAP,
:CREATE_BLOCK.BRAND_CODE,-- SYSDATE, SYSDATE, USER, NULL,
O_ERR_MSG);

COMMIT;

MSG_SUCCESS('Success to created!');


ELSE

MSG_SUCCESS(O_ERR_MSG);

END IF;

IF (:CREATE_BLOCK.COMPANY IS NULL AND
:CREATE_BLOCK.NEO_LOC IS NULL AND
:CREATE_BLOCK.OFIN_LOC IS NULL AND
:CREATE_BLOCK.OCC IS NULL AND
:CREATE_BLOCK.SEGMENT12_MAP IS NULL AND
:CREATE_BLOCK.BRAND_CODE IS NULL ) THEN


L_SUCCESS := cmx_OFIN_MAP_UTILITY.CMX_LOC_IUD (:CREATE_BLOCK.COMPANY,
'CMX_OFIN_LOC_MAPPING' ,
'I',
:CREATE_BLOCK.NEO_LOC,
:CREATE_BLOCK.OFIN_LOC,
:CREATE_BLOCK.OFIN_COMP,
:CREATE_BLOCK.OCC,
:CREATE_BLOCK.SEGMENT12_MAP,
:CREATE_BLOCK.BRAND_CODE,-- SYSDATE, SYSDATE, USER, NULL,
O_ERR_MSG);

COMMIT;


MSG(O_ERR_MSG);

ELSE

L_SUCCESS := FALSE;

MSG(O_ERR_MSG);

END IF;

EXCEPTION
when FORM_TRIGGER_FAILURE then
raise;
when OTHERS then

raise FORM_TRIGGER_FAILURE;

END ;
Re: WHEN-BUTTON-PRESSED event issue [message #685114 is a reply to message #685112] Tue, 26 October 2021 02:53 Go to previous messageGo to next message
andycheng884
Messages: 3
Registered: October 2021
Junior Member
Hi Expert,

I updated my script. Then, my question have 2 parts. For the part 1 as "Check Null record in text item and LOV field".

Event: WHEN-VALIDATE-ITEM (Text Item)
IF (:CREATE_BLOCK.COMPANY IS NULL AND F_SHOW_LOV('LOV_COMPANY_CREATE') IS NULL ) THEN

MSG('Cannot to Null record!');
RAISE FORM_TRIGGER_FAILURE;

END IF;

The result is fail. When I delete the data in the text field but the error message is not trigger.

For my part 2: WHEN-BUTTON-PRESSED

DECLARE

O_ERR_MSG nvarchar2 (500);
L_SUCCESS BOOLEAN;
v_count number;


BEGIN

SELECT count (*)
INTO v_count
FROM CMX_OFIN_LOC_MAPPING
WHERE company = :CREATE_BLOCK.COMPANY
AND NEO_LOC = :CREATE_BLOCK.NEO_LOC
AND OFIN_LOC = :CREATE_BLOCK.OFIN_LOC
AND OFIN_COMP = :CREATE_BLOCK.OFIN_COMP
AND OCC = :CREATE_BLOCK.OCC
AND segment12 = :CREATE_BLOCK.SEGMENT12_MAP
AND BRAND_CODE_IN = :CREATE_BLOCK.BRAND_CODE
;


IF (:CREATE_BLOCK.COMPANY IS NOT NULL AND
:CREATE_BLOCK.NEO_LOC IS NOT NULL AND
:CREATE_BLOCK.OFIN_LOC IS NOT NULL AND
:CREATE_BLOCK.OFIN_COMP IS NOT NULL AND
:CREATE_BLOCK.OCC IS NOT NULL AND
:CREATE_BLOCK.SEGMENT12_MAP IS NOT NULL AND
:CREATE_BLOCK.BRAND_CODE IS NOT NULL) AND v_count < 1 THEN


L_SUCCESS := cmx_OFIN_MAP_UTILITY.CMX_LOC_IUD (:CREATE_BLOCK.COMPANY,
'CMX_OFIN_LOC_MAPPING' ,
'I',
:CREATE_BLOCK.NEO_LOC,
:CREATE_BLOCK.OFIN_LOC,
:CREATE_BLOCK.OFIN_COMP,
:CREATE_BLOCK.OCC,
:CREATE_BLOCK.SEGMENT12_MAP,
:CREATE_BLOCK.BRAND_CODE,-- SYSDATE, SYSDATE, USER, NULL,
O_ERR_MSG);

COMMIT;

MSG_SUCCESS('Success to created!');
RAISE FORM_TRIGGER_FAILURE;



IF L_SUCCESS = FALSE THEN

dbms_output.put_line(O_ERR_MSG);

ELSE

MSG(O_ERR_MSG);
RAISE FORM_TRIGGER_FAILURE;

END IF;

END IF;
EXCEPTION
when FORM_TRIGGER_FAILURE then
raise;
when OTHERS then

raise FORM_TRIGGER_FAILURE;

END ;

The result is fail. I try to call procedure in the forms but the error message is not to show on screen. may I know my script any problem?
Re: WHEN-BUTTON-PRESSED event issue [message #685133 is a reply to message #685114] Wed, 27 October 2021 22:43 Go to previous message
andycheng884
Messages: 3
Registered: October 2021
Junior Member
Hi, Expert.

The problem was fixed.

Thanks for your help.

Thanks,
Andy
Previous Topic: affectation de sysdate avec format ('DD/MM/RRRR HH24:MI:SS') à un item (3 merged)
Next Topic: PDF upload as an attachment? (3 merged)
Goto Forum:
  


Current Time: Fri Mar 29 08:12:10 CDT 2024