browse_total_rows

Questions related to customising nuBuilder Forte with JavaScript or PHP.

browse_total_rows

Unread postby kknm » Thu Apr 30, 2020 4:36 am

error.PNG
error.PNG (11.1 KiB) Viewed 2038 times
Used browse_total_rows from nuBuilder4-Code-Library.
I have a strange output in 1 column(SUM), with the same formats in other columns (input=Number).
Last edited by kknm on Thu Apr 30, 2020 6:11 pm, edited 1 time in total.
kknm
 
Posts: 231
Joined: Sat Apr 11, 2020 7:33 am

Re: browse_total_rows

Unread postby kev1n » Thu Apr 30, 2020 12:22 pm

The image is not displayed. Can you upload it again?
kev1n
nuBuilder Team
 
Posts: 2048
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: browse_total_rows

Unread postby kknm » Thu Apr 30, 2020 6:15 pm

kev1n wrote:The image is not displayed. Can you upload it again?

Uploaded a new one, sorry I have not yet mastered the forum
kknm
 
Posts: 231
Joined: Sat Apr 11, 2020 7:33 am

Re: browse_total_rows

Unread postby kev1n » Thu Apr 30, 2020 7:07 pm

What output do you get when you enter this in the developer console (Press F12 to bring up the browser's Developer Console)

Code: Select all
window.nuFORM.getCurrent().browse_columns[2].format
kev1n
nuBuilder Team
 
Posts: 2048
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: browse_total_rows

Unread postby kknm » Thu Apr 30, 2020 8:13 pm

kev1n wrote:What output do you get when you enter this in the developer console (Press F12 to bring up the browser's Developer Console)

Code: Select all
window.nuFORM.getCurrent().browse_columns[2].format


in console - ""
Even when choosing a format, the sum in the first calculated column is float, in the rest the integer
kknm
 
Posts: 231
Joined: Sat Apr 11, 2020 7:33 am

Re: browse_total_rows

Unread postby kev1n » Thu Apr 30, 2020 8:26 pm

Please also run this code in the dev. console and post the output here:

Code: Select all
var c = window.nuFORM.getCurrent().browse_columns;
var x = "";
for (var index = 0; index < c.length; ++index) {
    x = x + "\n Column " + index + " : " + c[index].format;
}
alert(x);
kev1n
nuBuilder Team
 
Posts: 2048
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: browse_total_rows

Unread postby kknm » Thu Apr 30, 2020 9:05 pm

kev1n wrote:Please also run this code in the dev. console and post the output here:

Code: Select all
var c = window.nuFORM.getCurrent().browse_columns;
var x = "";
for (var index = 0; index < c.length; ++index) {
    x = x + "\n Column " + index + " : " + c[index].format;
}
alert(x);
Screenshot .PNG
Screenshot .PNG (104.54 KiB) Viewed 2028 times
kknm
 
Posts: 231
Joined: Sat Apr 11, 2020 7:33 am

Re: browse_total_rows

Unread postby kev1n » Thu Apr 30, 2020 10:03 pm

It looks like no number format was selected.

https://streamable.com/3ckatd
kev1n
nuBuilder Team
 
Posts: 2048
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: browse_total_rows

Unread postby kknm » Thu Apr 30, 2020 10:36 pm

kev1n wrote:It looks like no number format was selected.

https://streamable.com/3ckatd

Did everything by reference, but the sum = 3226.2, although it should be 3226.3
kknm
 
Posts: 231
Joined: Sat Apr 11, 2020 7:33 am

Re: browse_total_rows

Unread postby kev1n » Thu Apr 30, 2020 11:04 pm

kknm wrote:
kev1n wrote:It looks like no number format was selected.

https://streamable.com/3ckatd

Did everything by reference, but the sum = 3226.2, although it should be 3226.3


That's because nuBuilder's addFormatting() does not round correctly from a mathematical point of view. It just trims off the additional decimal places.

Code: Select all
nuFORM.addFormatting(3226.29, "N|1000.0")
outputs 3226.2

but
Code: Select all
(3226.29).toFixed(1);
rounds to 3226.3
Last edited by kev1n on Thu Apr 30, 2020 11:34 pm, edited 1 time in total.
kev1n
nuBuilder Team
 
Posts: 2048
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Next

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 4 guests

cron