This topic is locked

How to perform calculations between totals on the List page

7/30/2015 3:51:18 PM
PHPRunner Tips and Tricks
admin

Q: I have two totals on the List page. I need to divide one total by another and display result next to them on the same page.
A: Here is how we can do this.In BeforeDisplay event of this page you can access those totals variables and perform calculations.

  1. Create we are going to add a custom variable to this page


2. To do so we need to switch to HTML mode and insert {$mytotal} placeholder


3. Now we add the following in BeforeDisplay event of this page:

$credit = strip_tags($xt->getvar("Credit_total"));

$debit = strip_tags($xt->getvar("Debit_total"));

if ($debit!=0)

$xt->assign("mytotal",$credit/$debit);


4. And this is how it looks in generated application

90288 11/24/2017

Very useful but seem to be not working when $credit and $debit are set as currency
any idea??



Q: I have two totals on the List page. I need to divide one total by another and display result next to them on the same page.
A: Here is how we can do this.In BeforeDisplay event of this page you can access those totals variables and perform calculations.

  1. Create we are going to add a custom variable to this page

  2. To do so we need to switch to HTML mode and insert {$mytotal} placeholder

  3. Now we add the following in BeforeDisplay event of this page:

$credit = strip_tags($xt->getvar("Credit_total"));

$debit = strip_tags($xt->getvar("Debit_total"));

if ($debit!=0)

$xt->assign("mytotal",$credit/$debit);


4. And this is how it looks in generated application


mbintex 12/13/2017

is this working for reports too?