Search code examples
oracle-databaseplsqloracle12coracleforms

How to assign a negative value to a Formula based on a checkbox value in Oracle Forms?


I have a tabular transaction form with a checkbox for Buy/Sell, quantity, price, extended_price (Formula of quantity * price) and extended_price_total (Summary of extended_price). When the checkbox on the tabular form is set to Buy, extended_price is positive, and Sell means it’s negative.

Earlier I attempted to make a post -query trigger, but I have been told to simply create a hidden dummy item and add this item to my formula (quantity * price* dummy).

Can anyone help me as to how I go about creating a dummy item which will assign itself a value of 1 or -1 based on a separate checkbox item in my data block?


Solution

  • Create a WHEN-VALIDATE-ITEM trigger on the checkbox item:

    :block.dummy := case when :block.checkbox_item = 'A'  -- or whichever value you chose to
                              then 1                      -- represent checked checkbox
                         else -1
                    end;