printing bug using element.format

Another interesting printing issue/bug.

I have a layout which prints out numeric numbers rounded to decimal places that can be adjusted by the user.

So i use the “elements.field1.format = varRounddigits” code.

On screen, the rounding works perfectly. If user wants to round it to “4” digits, in browse mode, it shows the field1 rounded to 4 digits.

However, when i print (or just use print preview), the rounding format completely goes away. Am I doing something wrong?

Please help.

thanks
sammy

anyone try this out? is this a legitimate bug?

sounds like a bug.
Why don’t you work around it by creating a calc which renders your number as a string…?

A bit of a hazzle, but the only way I have found to do multicurrency invocing…

I just realized that this won’t work still because even if I round the number into a calculated TEXT field, I still won’t get the trailing 0s.

My calculation field code is a little like this:

var multiplier = Math.pow(10, wall1roundingrule)

return Math.round(multiplier * wall1) / multiplier

this does the rounding perfectly fine, but if my “wall1roundingrule” field is set to 4. and the number turns out to be .04, I NEED to show .0400; servoy can only show .04 . Please help!

sammy

Why don’t you just change the “format” of the field to: #.000 ??

Seems easy.

bcusick:
Why don’t you just change the “format” of the field to: #.000 ??

Seems easy.

I need to make the .000 dynamic. For some item #s, we need .010500; some item #s, we need .1050; The format is controlled by a stored field. We use the elements.format in an onshow script to display during runtime. That wasn’t an issue. However, when it comes to printing, the elements.format does not work.
any ideas?

PRINTING! Ah, OK.

In 3.0 the printing engine will keep the formatting. Have you tried with a BACKUP COPY of your solution?

If you must stick with 2.2.x - then just make a HTML calc that will format the way you want.