Crystal Reports string to eliminate the leading zeros

SOLVED

Does anyone have a revised Crystal Reports string to eliminate the leading zeros on an invoice and or purchase order?

  • 0
    SUGGESTED

    Hello,

    Try this.  For an invoice the field that holds the invoice number is SALES_HISTORY_HEADER.NUMBER, and for the purchase order the field is PURCHASE_ORDER_HEADR.NUMBER. 

    Create a formula in the invoice and purchase order. 

    The Invoice number formula will be: tonumber({SALES_HISTORY_HEADER.NUMBER})

    The Purchase Order number formula will be: tonumber({PURCHASE_ORDER_HEADR.NUMBER})

    Place the formula on the report.

    Right-click the formula and click Format Field. In the Number tab, click Customize near the bottom.  Change Decimals to 1 and remove the checkmark for Thousands Separator.  Click OK.  Click OK again to save the formatting properties.  Save your form. 

  • +1 in reply to jkwa
    verified answer

    I actually figured it out a week ago to create a new formula.

    the tonumber command left a decimal place after the number so I used this formula:

    if NumericText({X})
    then
    ToText(ToNumber({X}),0,"")
    else
    {X}

    and replaced {X} with the number I wished to change.

    The problem I had was I tried to change the existing formula using this which did not work.

    after watching a YouTube video I figured out to add a formula instead of changing the existing one.

    If anyone wants a more detailed way to do this just ask.