Thursday, June 8, 2017

Data Validation


In the name of Allah, Most Gracious, Most Merciful
Praise be to Allah, blessing and peace be upon our prophet Mohammed, his family and his companions. After that,


         A successful applications, mainly rely on data validation strategies.     
 It involves understanding  the user business requirements, increase the usability and reliability of  your application and effectively test its data validation to reduce the long-term cost of your software application. On the other hand, this result in reducing the cost of validation for each subsequent release of your application.


Task Definition:   

Enforce validation of  one form to equal the summation of other form items. e.g. item1 =  item2 +  item3 +  item4 
Then, prevent the user from saving the data if the condition violated


Task Solution:

To enforce validation of  one form to equal the summation of other form items  if the condition violated you  have to:

 Create WHEN-VALIDATE-RECORD Trigger (block level)



DECLARE


         tot NUMBER  :=0 ;

BEGIN
     
     tot := NVL(:item2,0) + NVL(:item3,0) + NVL(:item4,0) ; 

IF tot  <> :item1 THEN

     -- Create a message or Alert here 

MESSAGE('Please Check Related Quantities to FormItem1');
PAUSE

END IF;

END;



To Prevent the application user from saving the form  if the condition violated you have to:

Create PRE-INSERT or PRE-COMMIT Trigger ( form level)

 
DECLARE


     tot NUMBER  :=0 ;

BEGIN

    tot := NVL(:item2,0) + NVL(:item3,0) + NVL(:item4,0) ;

IF tot  <> :item1 THEN

     -- Create a message or Alert here 


MESSAGE('Please Check Related Quantities to FormItem1');
PAUSE;

-- To prevent a user fro saving the violated condition use...

     RAISE FORM_TRIGGER_FAILURE;

END IF;

END;



Learn more about:

           Oracle Report With No Data
·          Oracle Forms Data Exchange
·           


Hope this helps...

My success only comes from Allah, pls. note your comments and suggestions are great help for me in progress thanks in advance.