Forum Stats

  • 3,837,076 Users
  • 2,262,223 Discussions
  • 7,900,198 Comments

Discussions

Master/Detail Auto calculate column plsql expression

User_0KLNU
User_0KLNU Member Posts: 1 Green Ribbon

Trying to do a simple: ":units * :cost" when user selects product drop-down and failing with conversion error. They're both number types and both work individually but can't seem to multiply them. Can't seem to find any working examples online either.

Thx

Answers

  • Adnan3114
    Adnan3114 Member Posts: 11 Red Ribbon

    Provide more details about the setup of your page. Is the region Interactive grid? Is the drop-down part of the Grid or is it a master item above it?

    Better would be to post a photo of your page.

    Ashraf86
  • Schoony-Oracle
    Schoony-Oracle Member Posts: 2 Employee

    Posting a few pics.

    This is the error after I select a product from the drop down.

    SetValue Code:

    DB Table:


  • Adnan3114
    Adnan3114 Member Posts: 11 Red Ribbon
    edited Aug 3, 2022 4:58PM

    I just tried it on my APEX using same method and it worked. I think the scale and precision difference between the two columns is causing the error? Use TO_NUMBER function with ROUND and see what happens.

    EDIT: I think you are using Format Mask for one column (unit price). Try removing all format masking and see what happens.

    Ashraf86
  • Schoony-Oracle
    Schoony-Oracle Member Posts: 2 Employee
    edited Aug 3, 2022 5:43PM

    Thx for the sanity check!

    I think what is happening is that the Unit Price's dollar amount is being passed in as a string, e.g. :unit_price = '$475.00'. When I cast it using to_number the calculation works.

    to_number(:unit_price, '$99999.99') * :quantity;

    Again, I appreciate the help!

    Just saw your edit. Yup, that (format mask) was it.