Crystal Reports for Eclipse Designer Guide

Truncate

Description
Truncate(x) returns either a fractional or whole number by truncating the number at the decimal point.
Overloads
  • Truncate (x)
  • Truncate (x, #places)
  • Arguments
  • x is a Number or Currency to be truncated.
  • #places is a whole number indicating how many decimal places are to remain after the value is truncated. (This argument is optional.)
  • Returns
    Number
    Action
    If the #places argument is specified, the number is truncated to the decimal place indicated and the function returns a fractional Number. If #places is negative, the number is rounded to the first ten, hundred, and so on.
    Typical uses
    Use this function whenever the characters to the right of the decimal are not needed for a report or calculation.
    Examples
    Truncate(1.23456)
    Returns 1.
    Truncate(1.499)
    Returns 1.
    Truncate(1.599)
    Returns 1.
    Truncate(1.999)
    Returns 1.
    Truncate(12346.33, 1)
    Returns 12346.3.
    Truncate(12345.33, -2)
    Returns 12300.00.
    If you have 147 golf balls in stock and want to know how many dozen are available for sale, your calculation is 147/12=12.25 12.25 (truncated) = 12 dozen available for sale. If you sell balls only by the dozen, the .25 dozen you truncated is unimportant.
    Truncate({file.BALL INVENTORY} / 12)
    Returns 12 where Ball inventory = 147 (147 / 12 = 12.25, 12.25 truncated = 12).
    Truncate({file.BALL INVENTORY} / 12)
    Returns 12 where Ball inventory = 155 (155/12 = 12.92, 12.92 truncated = 12).
    Truncate({file.BALL INVENTORY} / 12)
    Returns 13 where Ball inventory = 157 (157/12 = 13.08, 13.08 truncated = 13).
    See Also



  • SAP BusinessObjects
    http://www.sap.com/sapbusinessobjects/
    Support services
    http://service.sap.com/bosap-support/
    Product Documentation on the Web
    http://help.sap.com/