This topic is locked

Calculate summary values in reports

6/12/2010 7:17:18 PM
PHPRunner General questions
S
skiswani author

Hello,

I have this report which has two columns , I have a sum for each , now I want to divide the result (summary) of the first one by the other.

for example :

F1 | F2

---- | -----

1 | 5

4 | 2

6 | 1

--- | ----

11 | 8 (i want to DISPLAY here the value of 11/8 )
thank you

S
skiswani author 6/13/2010

Hello,

anybody could help me in this issue , any ideas will be so appreciated.
thanks

D
danaci 6/13/2010

inser code snippet on report page.
global $conn;
$strSQLExists = "select sum(f1) as f1_sum, sum(f2) as f2_sum from yourTable where AnyColumn='SomeValue'";
$rsExists = db_query($strSQLExists,$conn);
$data=db_fetch_array($rsExists);
if($data)
{
// if record exists do something
}
else
{
// if dont exist do something else
}

S
skiswani author 6/13/2010

That was helpful thank you