cancel
Showing results for 
Search instead for 
Did you mean: 

Setting decimal place on a report field

Former Member
0 Kudos

Hello,

I am using Crystal 10 and I have embedded sub-reports that contain fields/formulas that display 6 decimal places on my report. I've attempted to use the TOTEXT({OEORDD.UNITPRICE},2) formula but am having issues. Here is what my formula does now

        // Price by Quantity and No Detail Discount

        // Print the Unit Price

        //TOTEXT({OEORDD.UNITPRICE}, {OEORDD.UNITPRCDEC})

TOTEXT({OEORDD.UNITPRICE},2)

    ELSE

        IF {OEORDD.QTYORDERED} <> 0 THEN

            ToText((({OEORDD.EXTINVMISC} - {OEORDD.INVDISC}) /

                     {OEORDD.QTYORDERED}), {OEORDD.UNITPRCDEC})

        ELSE

            ""

ELSE

    ""

Currently all output is :48.000000  I'd like it to only show 2 decimal places = 48.00

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Dell, Thank you for the response. I made an attempt to add your rounding option to the string and I went from 48.000000 to 48.000 I'm getting closer. I was wondering if the problem is in the last portion of my formula following the ELSE IF?

// Price by Quantity and No Detail Discount

        // Print the Unit Price

       // TOTEXT({OEORDD.UNITPRICE}, {OEORDD.UNITPRCDEC})

totext(round({OEORDD.UNITPRICE},2),2)

    ELSE

       IF {OEORDD.QTYORDERED} <> 0 THEN

            ToText((({OEORDD.EXTINVMISC} - {OEORDD.INVDISC}) /

                     {OEORDD.QTYORDERED}), {OEORDD.UNITPRCDEC})

        ELSE

            ""

ELSE

    ""

abhilash_kumar
Active Contributor
0 Kudos

Hi Joel,

It seems this field decides the decimals: {OEORDD.UNITPRCDEC}

If you always want two decimals, you should use:

ELSE

       IF {OEORDD.QTYORDERED} <> 0 THEN

            ToText((({OEORDD.EXTINVMISC} - {OEORDD.INVDISC}) /

                     {OEORDD.QTYORDERED}), 2)


-Abhilash

Former Member
0 Kudos

Hello Abhilash Thank You for your help. I think the problem may lay in another area of the formula I applied your suggestions and the output was the same here is the entire formula and output results:

IF {OEORDD.LINETYPE}=1 THEN

    IF {OEORDD.PRPRICEBY} = 1 AND

        {OEORDD.INVDISC} = 0 THEN

        // Price by Quantity and No Detail Discount

        // Print the Unit Price

        TOTEXT({OEORDD.UNITPRICE}, {OEORDD.UNITPRCDEC})

    ELSE

        IF {OEORDD.QTYORDERED} <> 0 THEN

            ToText((({OEORDD.EXTINVMISC} - {OEORDD.INVDISC}) /

                     {OEORDD.QTYORDERED}),2)

        ELSE

            ""

ELSE

    ""

Results:

abhilash_kumar
Active Contributor
0 Kudos

Change it to:

IF {OEORDD.LINETYPE}=1 THEN

    IF {OEORDD.PRPRICEBY} = 1 AND

        {OEORDD.INVDISC} = 0 THEN

        // Price by Quantity and No Detail Discount

        // Print the Unit Price

        TOTEXT({OEORDD.UNITPRICE}, 2)

    ELSE

        IF {OEORDD.QTYORDERED} <> 0 THEN

            ToText((({OEORDD.EXTINVMISC} - {OEORDD.INVDISC}) /

                     {OEORDD.QTYORDERED}),2)

        ELSE

            ""

ELSE

    ""

-Abhilash

Former Member
0 Kudos

Abhilash Thank You! This was the fix!

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

Try this:

ToText(Round({OEORDD.UNITPRICE},2), 2)

-Dell