This topic is locked
[SOLVED]

 Calculation from a column Total on report

10/10/2011 2:59:15 AM
PHPRunner General questions
S
Sami author

Hello All,
I want to add a new snippet to the report so I'll do on it a calculation from two Total results of two columns but I didn't get the road to that
so, I see snippets like {$total1_sum}, {$total2_sum} in the visual editor and I want to add another snippet that calculate for example {$total1_sum}/{$total2_sum}
Please guide me how to do it...

C
cgphp 10/10/2011

In the "Before display" event of the report enter the following code:

$sum_1 = $xt->getvar("total1_sum");

$sum_2 = $xt->getvar("total2_sum");

$division = $sum_1 / $sum_2;

$xt->assign("division",$division);



In the Visual editor section, switch to HTML mode and where you want to see the division result enter this template var:

{$division}
S
Sami author 10/10/2011

Wooow.. It works so fantastic
Thank you very much bro

S
Sami author 11/8/2011

Hello again
I have another problem here:

{$division}


This value doesn't show on (Print Report Page)

please tell me how to fix it, or how to add events to the (Print Report Page,Before display)