Page 2 of 4
Re: browse_total_rows
Posted: Thu Apr 30, 2020 3:43 pm
by kev1n
As a quick workaround, try this:
Replace
this line
Code: Select all
tCell.html('<b>' + nuFORM.addFormatting(result, f) + '</b>');
with this code:
Code: Select all
tCell.html('<b>' + result.toFixed(1); + '</b>');
Re: browse_total_rows
Posted: Thu Apr 30, 2020 3:46 pm
by kknm
Why is this not observed in other columns?
Re: browse_total_rows
Posted: Thu Apr 30, 2020 4:04 pm
by kknm
kev1n wrote:As a quick workaround, try this:
Replace
this line
Code: Select all
tCell.html('<b>' + nuFORM.addFormatting(result, f) + '</b>');
with this code:
Code: Select all
tCell.html('<b>' + result.toFixed(1); + '</b>');
Inserted so:
Code: Select all
tCell.html('<b>' + result.toFixed(1) + '</b>');[/code
It worked
One more question
It seems that no one is moderating the “Reports” forum thread, maybe you will answer my question in that thread?
Re: browse_total_rows
Posted: Thu Apr 30, 2020 4:07 pm
by kev1n
kknm wrote:Why is this not observed in other columns?
Well, nuBuilde just trims off the additional decimal places. It could be that the mathematically rounded result is identical to the truncated result in the other columns.
Re: browse_total_rows
Posted: Thu Apr 30, 2020 4:11 pm
by kev1n
If you're looking for a "real fix", you could also try patching
nuformclass.js directly
Replace this line:
Code: Select all
var s = String(d + String(0).repeat(100)).substr(0, F.places).trim();
With this one:
Code: Select all
var s = Number('0.'+ d).toFixed(F.places).slice(2);
I did not do exhaustive testing, but it seemed to work. I.e. the rounding is correct now.
(You have to log in again after the change)
Re: browse_total_rows
Posted: Fri May 01, 2020 1:16 pm
by kknm
I will definitely try your recommendations.
I want to clarify - can I take out browse_total_rows.js in a separate procedure to access it from different forms?
Re: browse_total_rows
Posted: Fri May 01, 2020 1:53 pm
by kev1n
Sure, you can do that by
including the JavaScript as an external file.
To do so,
1. Create a new folder (e.g.) /libs in the root directory of nuBuilder and place the browse_total_rows.js file there.
2. Include the file in the header field. (Setup -> Header)
setup_header.jpg
Code: Select all
</script>
<script src='libs/browse_total_rows.js' type='text/javascript'></script>
Re: browse_total_rows
Posted: Sun May 03, 2020 2:13 pm
by kknm
kev1n wrote:If you're looking for a "real fix", you could also try patching
nuformclass.js directly
Replace this line:
Code: Select all
var s = String(d + String(0).repeat(100)).substr(0, F.places).trim();
With this one:
Code: Select all
var s = Number('0.'+ d).toFixed(F.places).slice(2);
I did not do exhaustive testing, but it seemed to work. I.e. the rounding is correct now.
(You have to log in again after the change)
I tried this with the original browse_total_rows, but that didn't work.
Then I tried this with the correct browse_total_rows, it works correctly,although, it seems, without nuformclass.js it was correct.
Re: browse_total_rows
Posted: Sun May 03, 2020 4:29 pm
by kev1n
kknm wrote:I tried this with the original browse_total_rows, but that didn't work.
What do you mean, it didn't work? It works for me just fine. After the change you have to log in again.
Re: browse_total_rows
Posted: Tue May 05, 2020 4:31 pm
by kknm
Yes, the original script now works correctly. I remember exactly that I was leaving nubuilder.
It seems that only after turning off the computer did it work.