number format on reports

Questions related to using nuBuilder Forte.

Re: number format on reports

Unread postby Janusz » Wed Dec 02, 2020 4:45 am

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 belowe):
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 (22.49 KiB) Viewed 77 times
If you like nuBuilder, please leave a review on SourceForge
nuBuilder Team
Posts: 446
Joined: Fri Dec 28, 2018 10:11 pm
Location: Krakow, Poland
nuBuilder Version: 4.5


Return to General

Who is online

Users browsing this forum: No registered users and 14 guests