Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    2

    Unanswered: Field padding while dropping "," and decimal

    I am trying to create a formula field in Crystal Report XI that takes a monetary/numeric field and converts it to 10 characters with preceding zeroes, while dropping any commas or decimals. For example: 2,907.41 becomes 0000290741. Does anyone have any idea of how to do this?

  2. #2
    Join Date
    Oct 2010
    Posts
    46
    You can easily achieve that (converting to 0000290741) by using the ToText function.


    Other methods of padding zeros to the number is by concatenation such as:

    "0000000000" + {Field};
    Right("0000000000" & {Field},10);

  3. #3
    Join Date
    Oct 2011
    Posts
    2
    Using the example number of 17,724.09>

    If I try using ToText, (totext({CheckHed1.CheckAmt},"0000000000"))

    I get 0000017724

    If I use your example, ("0000000000" + cstr({CheckHed1.CheckAmt});
    Right("0000000000" & {CheckHed1.CheckAmt},10);

    I get 017,724.09

    I also tried replacing cstr with totext, and that didn't make any difference. Am I doing something wrong?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •