Adil
Adil

Reputation: 11

Multi Record Validation in Oracle Forms

Form Field

I wanted to apply validation on Plan Ratio field if user entered ratio exceed 100 then show error how can I do in when validate trigger as plan ratio is the same field but have different records

Upvotes: 1

Views: 1013

Answers (1)

Andris Krauze
Andris Krauze

Reputation: 2142

You can setup an invisible Calculated Item, that sums up Plan ratio field, name it for instance as SUMMARY_FIELD and then add WHEN-VALIDATE-ITEM trigger for each Plan ratio item of the records like this:

BEGIN
    IF :SUMMARY_FIELD>100 THEN
        message('nok'); --or whatever alert you like
        RAISE Form_Trigger_Failure;
    END IF;
END;

PS. How to create Calculated Item:

To create a calculated item:

1. In the Object Navigator, create a new interface item (make sure it is a control item). 



  Tip: The item's datatype must be compatible with the calculation you wish to use to 

   compute the item's value. For example, if you wish to compute an item's value with the 

   Sum function, create an interface item of datatype Number. 



2. Double-click the item's object icon to display the Property Palette. 

3. Under the Calculation node, set the item's Calculation Mode property to Formula or 

   Summary. 

4. If you set Calculation Mode to: 



   Formula, click on the Formula property, click the More button to display the Formula 

   dialog, and type a PL/SQL expression to define the formula. Click OK to compile the 

   expression.  



   Summary, use the Summary Function popList to select a summary type, then use the 

   Summarized Block and Summarized Item popLists to select the block and item whose 

  values will be summarized to compute a value for the calculated item.

Upvotes: 1

Related Questions