This topic is locked

Totaling the toals of all fields?

8/15/2007 11:38:16 AM
PHPRunner General questions
R
rcurtin author

Hi,
I am using PHP Runner 4.0 build 258 and I was just curious if you can total the totals of all the fields on a page? I am using 6 blank tables in my MS Access database and added custom SQL code for these tables. Basically this code just queries data from up to 7 different tables to display it into one depending on which product you are looking at. I have these fields totaling at the bottom I just would love to see a total of the totals. Say if an employee wanted to do an advanced search for a between date range and there is all the totals for that date range I want a total to see how many for that timeframe instead along with the allready there totals for each field.

J
Jane 8/16/2007

Hi,
you can add totals on the Fields order and totals tab in the PHPRunner.

R
rcurtin author 8/16/2007

Well I have the fields totaling but I need all the totals to be totaled if possible. This image is the bottom of all my fields I want to add them from left to right or right to left.


So I wanna add the 822 to the 206 and the 11 so a seperate field showing total of 1039 (or whatever the total may be at the time)

R
rcurtin author 8/24/2007

just a friendly BUMP to see if anyone knows how to do this. Just want to total all the allready totaled totals..

J
Jane 8/27/2007

Hi,
to calculate global total use List Page: Before display event on the Events tab.

Here is a sample code:

$val1 = $smarty->get_template_vars('showtotal_Fieldname1');

$val2 = $smarty->get_template_vars('showtotal_Fieldname2');

$val3 = $smarty->get_template_vars('showtotal_Fieldname3');
$val1 = strip_tags($val1);

$val2 = strip_tags($val2);

$val3 = strip_tags($val3;

$sum = $val1+$val2+$val3;
echo "Global total = ".$sum;

M
Max68 8/27/2007

[quote name='Jane' date='Aug 27 2007, 08:24 AM' post='20846']

Hi,
I've the latin (italian) number format, can you help me with the script to correctly sum the variables and to put the result in a cell that I want?
Thank you.

Max

M
Max68 8/29/2007

I've found the solution to do correctly the sum with latin number format, but i don't know how put the result (in the esample echo $sum) in a cell of the same row of other totals.

anyone knows how to do this?
Thank you.

Max

Alexey admin 8/29/2007

Max,
open your page in Visual Editor, right-click the place you want to insert a sum and select Insert PHP code snippet item.

Put your code with echo there.

R
rcurtin author 10/18/2007

Well I have this semi working.....
Ok so I put in the code in the events and I tried to put in the variable to display in the field... All I get is a blank value in the field and the actual information I want to display in the field at the very bottom of the screen.
The reason as far as I can tell for the info displaying at the bottom of the screen is the echo statement is in the event page. but if I put the same statement in the field all it does is displays the code not the actual output... I am only using 4.0 at the moment because I am waiting for my 4.1 registration key. So I don't know if that would make a difference or not but I am so close now. I have stated this before most of this php stuff is out of my league but I get by heh so if you could explain it in lamens terms that would be great.
fyi a previous post said to

to calculate global total use List Page: Before display event on the Events tab.

Here is a sample code:


but I do not have a before display event listed anywhere.... so I have been using the on load event for the list page I need this on

R
rcurtin author 10/18/2007

Ok I figured it out myself there was no event even needed.... boy I feel kinda stupid LOL
all I had to do is in the field I wanted to display just type the text for the title then {$showtotal_firstfield+$showtotal_secondfield} and that displayed the total in the field. I just went into the output/templates folder and edited the page_list.htm and then put that code in there manually.
Thank you for the suggestions I just could not get any of them to work... hehe sorta ninjad my own fix

M
mustafa 10/23/2008

Hello,
Thank you all for this excellent work, PHPRunner.

Hi,

to calculate global total use List Page: Before display event on the Events tab.

Here is a sample code:


This isn't work in new version (v5.0).
For now, I know only a little about PHPRunner mechanism. Could you please give some cue? Thanks...

J
Jane 10/24/2008

Hi,
use following code in the PHPRunner 5.0:

global $totals;

$val1 = $totals["Fieldname1"];

$val2 = $totals["Fieldname2"];

$val3 = $totals["Fieldname3"];
$val1 = strip_tags($val1);

$val2 = strip_tags($val2);

$val3 = strip_tags($val3);

$sum = $val1+$val2+$val3;
echo "Global total = ".$sum;