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

Posted Image

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

Posted Image

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

Posted Image

Post a Comment