If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > Field padding while dropping "," and decimal

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-26-11, 12:35
stlawr stlawr is offline
Registered User
 
Join Date: Oct 2011
Posts: 2
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?
Reply With Quote
  #2 (permalink)  
Old 10-27-11, 12:09
mission mission is offline
Registered User
 
Join Date: Oct 2010
Posts: 44
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);
Reply With Quote
  #3 (permalink)  
Old 10-27-11, 12:34
stlawr stlawr is offline
Registered User
 
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On