Search code examples
oracleoracle-apex

Oracle Apex - Display Item as a Percentage


I'm trying to show a text field item as a percentage, issue is that there are several queries depending on this item (it refreshes reports based on the value).

Right now I have decimal values in there (1 = 100% , 0.5 = 50% and so on).

But the customer is asking to show this item as a percentage (50% when I have 0.5).

Does anyone know how to achieve this?

PS: The #col_name#% approach doesn't work well for this case.

Thanks


Solution

  • One way to solve this is to have the a 2nd item.

    • Suppose the base item is P1_COMMISSION and that is the value stored in the database - I suppose that would be a value between 0 and 1. Create another item called P1_COMMISSION_PCT which is displays the percent value. If this is a form item, this item would not have a database columns as source.
    • Make P1_COMMISSION hidden
    • Add a computation after the form initialisation to calculate the P1_COMMISSION_PCT based on P1_COMMISSION
    • Add a dynamic action on change of P1_COMMISSION_PCT to recalculate the value of P1_COMMISSION