Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Amount Format 1

Status
Not open for further replies.

suburbanites

Programmer
Aug 16, 2007
75
US
Hi, I am using Crystal XI SP1.

I have a check amount that I need to format. Example - 3,200.00. I would like to format this to print as *****3,200.00 with the asterisk as pad. How can I do this? The amount is numeric from teh database.

Thanks for your help in advance.
 
The example you show could be done by
Code:
"*****" & ToText(your.amount)
Of course amounts will vary, I assume you need enough asterisks to fill. This could be done by a set of tests of the amount.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
yes, i do need only enough asterisks to fill. the asterisks should expand and contract depending on the size of the amount. Is there any other way to code this?
 
Try:

stringvar amt := trim(ToText({your.amount}));

select len(amt)
case 4 : "*********" & amt
case 5 : "********" & amt
case 6 : "*******" & amt
case 7 : "******" & amt
case 8 : "*****" & amt
case 9 : "****" & amt
case 10 : "***" & amt
case 11 : "**" & amt
case 12 : "*" & amt
default : amt ;

Andy


 
Try this:

stringvar x := totext({table.amt},2);
replicatestring('*', 20-len(x))+ x

Substitute the total length of the asterisks + amount for the 20. You would need to use a non-proportional font, like Courier New for this to work properly.

-LB
 
Thanks you so much lbass. That was perfect! Thanks to everyone too for your time and attention.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top