Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

number format on reports

Questions related to using nuBuilder Forte.
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: number format on reports

Unread post by Janusz »

Hi,
The problem with formatting on the report looks to be related to the nuformat Form (on which formats are defined).
In case there is currency (sign) defined the format is following (for example):
€ 1,000.00 (with space between sign and number)
in case of no sign the space is left in the format.
and that is causing the problem in the function nuGetNumberFormat($f) in the ./nucommon.php
because we have comparison like "1,000.00" with " 1,000.00" - what is not equivalent and finally proper format is not assigned.

To corect the issue I modified the JS on the nuformat Form as following (3 last lines from the code below):

Code: Select all

...
        var si = $('#sign').val();
        var se = $('#separator').val();
        var pl = $('#places').val();
        var de = Number(pl) > 0 ? $('#decimal').val() : '';
        var cu = JSON.stringify([si,se,de,pl]);

var space='';
if (si!=='') {space=' ';}
        $('#srm_format').val(si + space +'1' + se + '000' + de + String(0).repeat(pl)).change();
...
and on the tests I performed so far it's working OK.
Przechwytywanie.JPG
You do not have the required permissions to view the files attached to this post.
If you like nuBuilder, please leave a review on SourceForge
Post Reply