Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to add percentage formatting to Ad Hoc report without multiplying by 100


    stasp
    • Features: Ad Hoc Version: v6.3.0, v6.2.1

    Use case

    The requirement in this case is to have the % symbol next to a value displayed in an Ad Hoc report. Since Ad Hoc reports utilize the formatting masks provided by Java, when adding the '%' to a number patter the value will automatically get multiplied by 100. When database data is already stored as a percentage value this additional multiplication is redundant and needs to be avoided.

    Solution

    The basic procedure to add/configure Ad Hoc data format masks is outlined in JRS Admin Guide (see the "Setting Data Format Masks" at the bottom of the page below):

    http://community.jaspersoft.com/documentation/tibco-jasperreports-server-administrator-guide/v630/creating-locale

    When using the % sign in a pattern mask, it needs to be additionally put into single quotes to avoid the multiplication of the original value, e.g.:

    ADH_100_MASK_int_4 = #.##0'%'
    ADH_100_MASK_dec_5 = #,##0.00'%'

    Here's how it looks in the adhoc_masks.properties file:

    adhoc_masks.png.bffc1ae529fcebdd862cf52fa292eb20.png

    For more details on Java pattern masks see the official documentation:

    https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html 

    -----------------------------

    Ref. case #01450871


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...