Converting dollar amounts to text

I have a check writing database that I designed. When it writes the check Panorama wonderfully write the numbers out as text. It displays the numbers written out as text followed by a series of asterisks. My problem is that I would always want the whole line to be 5 1/5 inches long. I want the correct number of asterisks to be inserted. Below is the formula that I used. I vaguely remember some sort of “Rep” that counted the correct number of asterisks to fill in weather it was short or long.

pattern(Total,"*** § dollar~ and ¢¢/100***************************************")

rep( could be used but you might find it easier to use a text funnel to allow a fixed number of characters:

(pattern(Total,"*** § dollar~ and ¢¢/100")+"***************************************")[1,50]

Either way, your numerals are always going to vary in width and there will be some drift. So you could just have your text area end at the right spot with no line wrap and overload it with trailing *'s that get truncated by the space limitation.

You could use a fixed width font like Courier or Monaco. If you open the Font Book app and select Fixed Width you see all those available fonts listed.

This kinda worked but I added a little work-around.
The alternate fonts were not a option with my form.
I used the (pattern(Total,"*** § dollar~ and ¢¢/100")+"******************************************************************************")[1,95]
but then I added a rectangle filled with white and no border to cover the remaining asterisk past the 5 1/2 inch mark. There is probably a better, simpler way to do this but it works for me.
Thanks for your suggestions.

You can use the rep( function instead of typing a bunch of asterisks. With this formula, you will always wind up with 95 characters total.

(pattern(Total,”*** § dollar~ and ¢¢/100”)+Rep(“*”,95))[1,95]

However, for a non-monospaced font, there is no way to create the correct amount of text in inches. You would have to add an overlapping rectangle filled with white as you have done, and then you will wind up with a partial asterisk on the end.

If the Text Display Object is sized to 5 1/2 inches and the Line Break option is set to Word Wrap you can avoid partial asterisks if you instead use a series of asterisks and spaces as in this formula:

pattern(Total,{ * * § dollar~ and ¢¢/100})+Rep(“* ”,55)

producing…

image

This will automatically remove any asterisk that doesn’t completely fit the area.

Thank you Gary. This worked exactly like I wanted it without the messy blank out rectangle. The Line Break option was important and did not work properly until it was set to Don’t Wrap.