This topic is locked

Total and Average

12/23/2010 2:07:34 AM
PHPRunner General questions
D
doykoes author

Dear All Expert,
How can i display Total and Average at the bottom of my list in PHP-53

Can anybody give me a suggest..
i'm trying using snipet but it does'nt work...
Thank You

Sergey Kornilov admin 12/23/2010

Proceed to 'Fields order and totals' screen to turn on totals.

D
doykoes author 12/26/2010



Proceed to 'Fields order and totals' screen to turn on totals.


Yes, but one field can only have one total type,

I try to one field have two total type, (average and total)

ie:

in field Sales

Sales 1 = 100

Sales 2 = 50

-------------

Average = 75

Total = 100

J
Jane 12/27/2010

Unfortunately PHPRunner do not allow to create two totals for one field.

As workaround you can calculate it manually using custom event on the Eventstab. Use List page: Before process to define new session variables, List page: After record processed event to add new value to these sessions (this event is executed for each row) and List page: Before display event to calculate totals and assign it.

Here is a sample List page: Before display event:

$average = $_SESSION["total"]/$_SESSION["number_of_records"];

$xt->assign("custom_total",$average]);



Then add {$custom_total} to the corresponding row on the Visual Editor tab in HTMLmode.

D
doykoes author 12/28/2010



Unfortunately PHPRunner do not allow to create two totals for one field.

As workaround you can calculate it manually using custom event on the Eventstab. Use List page: Before process to define new session variables, List page: After record processed event to add new value to these sessions (this event is executed for each row) and List page: Before display event to calculate totals and assign it.

Here is a sample List page: Before display event:

$average = $_SESSION["total"]/$_SESSION["number_of_records"];

$xt->assign("custom_total",$average]);



Then add {$custom_total} to the corresponding row on the Visual Editor tab in HTMLmode.


Thank you....

But please give me more detail.. where i did wrong...

Here my script :
List page: Before process

Global $total, $numrec;
List page: After record processed

$total = $row;

$numrec = $record;

( i don't know how to use $row and $ record...?)
List page: Before display

$average = $total/$numrec"];

$xt->assign("custom_total",$average]);
it doesn't work...Please.. Correct me with more detail...

Thank you...

D
doykoes author 12/30/2010

Hallo...?

Sergey Kornilov admin 12/30/2010

Doskeos,
you need to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.