Welcome to the nuBuilder Forums!

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

Great to be able to sum browse columns with nuGetBrowseSum()

Post Reply
Fike
Posts: 79
Joined: Thu Oct 20, 2011 9:13 pm

Great to be able to sum browse columns with nuGetBrowseSum()

Unread post by Fike »

Hi,

I have just found that now nuBuilder can sum the records of browese columns using the php nuGetBrowseSum() function and it is great!

I made some tests and I found that when the browse columns have format the sum does not display correctly (as shown on image below)
img_01.png
This is because $fields variable inside the nuSumColumns($s) function found on line 1759 of nuapi.php file, includes the the format of the field tables.

Therefore I relpaced line 1769 of the nuapi.php file

from:

Code: Select all

$SQL->addField('SUM(IFNULL(' . $fields[$i] . ')');
to:

Code: Select all

               $pos = strpos($fields[$i],'ORMAT(');
                        if($pos === false)
                        {

                               $fld = $fields[$i];
                        }
                        else
                        {
                              $fld_for = explode('ORMAT(',$fields[$i]);
                              $fld_com = explode(',',$fld_for[1]);
                              $fld = $fld_com[0].",'')";
                        }
                        $SQL->addField('SUM(IFNULL(' . $fld . ')');
Now the sum of browse column displays correctly (as shown on image below)
img_02.png
If there is a better way to make the nuSumColumns($s) function to compute the sum correctly when using formatted fields please share it.

KInd regrads,

Fike
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Great to be able to sum browse columns with nuGetBrowseS

Unread post by admin »

Fike,

My only answer would be to create another hidden column that is not formatted and sum that.

Steven
Post Reply