Options

Supress decimals in Reports

VijaykumarVijaykumar Member Posts: 36
Hi Everyone,

I want to know how I can suppress decimals in the report print.
For eg. if a column has value more than 2 decimals like 23.5433 but I want to print it in the report as 23.54, how do I go about it
The man who can own up to his error is greater than he who merely knows how to avoid making it.

Comments

  • Options
    GoMaDGoMaD Member Posts: 313
    You can set the DecimalPlaces on the column which holds the decimal value.

    Open the form in Design, click on the column which holds the field with the Decimal Value, open the properties and change the DecimalPlaces property.

    From the help function:
    DecimalPlaces
    Use this attribute to tell the system how to display decimal numbers if you want a format other than the default, which is two decimal places (for amounts).

    Applies to
    Fields, text boxes

    Settings
    You can enter a minimum and maximum value for the number of decimal places. For example...

    If you enter...
    The system interprets this as ...

    1 A minimum of 1 and a maximum of 1 decimal place
    1:4 A minimum of 1 and a maximum of 4 decimal places
    2: At least 2 decimal places
    :2 No more than 2 decimal places

    Comments
    If the setting for the field is greater than the setting for the text box (it cannot be less), the system uses the setting for the text box to determine how to round the number.

    For decimal fields, use this setting to specify the number of decimal places you want the system to store.

    For text boxes, you can use this property to limit the number of decimal places that appear, based on the setting for the field. You cannot increase the number of decimal places beyond what is set up for the field.

    For text boxes, you can change this property setting at runtime using C/AL code.

    The system checks this setting for the text box and for the field during validation.

    Regards,
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • Options
    rsfairbanksrsfairbanks Member Posts: 107
    One further point, format will overwrite this. I.e if you format the text box to currency it will always go to the default currency decimal places
  • Options
    KowaKowa Member Posts: 918
    You can also add ROUND(.....) to the source expression. If it is used without parameters it leaves just the two decimal places you need. :P
    You will need to rewrite the captions for these columns, though, if it is a table field with default caption you're printing ( i.e delete the <> Parantheses in the caption)
    Kai Kowalewski
  • Options
    VijaykumarVijaykumar Member Posts: 36
    Thanks everyone,
    the rounding method worked
    The man who can own up to his error is greater than he who merely knows how to avoid making it.
Sign In or Register to comment.