Welcome to the nuBuilder Forums!

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

browse_total_rows

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

browse_total_rows

Unread post by kknm »

error.PNG
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).
You do not have the required permissions to view the files attached to this post.
Last edited by kknm on Thu Apr 30, 2020 10:41 am, edited 1 time in total.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: browse_total_rows

Unread post by kev1n »

The image is not displayed. Can you upload it again?
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: browse_total_rows

Unread post by kknm »

kev1n wrote:The image is not displayed. Can you upload it again?
Uploaded a new one, sorry I have not yet mastered the forum
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: browse_total_rows

Unread post by kev1n »

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
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: browse_total_rows

Unread post by kknm »

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
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: browse_total_rows

Unread post by kev1n »

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);
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: browse_total_rows

Unread post by kknm »

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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: browse_total_rows

Unread post by kev1n »

It looks like no number format was selected.

https://streamable.com/3ckatd
kknm
Posts: 366
Joined: Sat Apr 11, 2020 12:03 am
Has thanked: 3 times
Been thanked: 4 times
Contact:

Re: browse_total_rows

Unread post by kknm »

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
kev1n
nuBuilder Team
Posts: 4305
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 446 times
Contact:

Re: browse_total_rows

Unread post by kev1n »

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 4:04 pm, edited 1 time in total.
Post Reply