This topic is locked

Syntax erro

2/2/2007 1:25:58 PM
PHPRunner General questions
R
renegadekn author

I'm getting an error on line 8 of this code, I using it in the onload custom code

<?php
function ListOnLoad()

{

global $strSQL;

//** Custom code ****

// put your custom code here

$values["netassets"] = $values["TotalIncome"] - ($values["TotalFixed"] + $values["TotalVariable"] + $values["TotalPeriodic"]);

}
?>
Can you tell me where I messed up?
Thanks
-Rob

Sergey Kornilov admin 2/2/2007

$values array is not defined in ListOnLoad event.
What do you like to do in this event?

R
renegadekn author 2/2/2007

$values array is not defined in ListOnLoad event.

What do you like to do in this event?


I'm trying to make the first field in the equation equal to $values["TotalIncome"] - ($values["TotalFixed"] + $values["TotalVariable"] + $values["TotalPeriodic"])

I had used something similar before and was trying to get it to work again. All of these are fields that already exist in the database.
-Rob

Sergey Kornilov admin 2/2/2007

Rob,
modify SQL for this purpose:

select ...,

TotalIncome - TotalFixed + TotalVariable + TotalPeriodic as netassets

from ...
R
renegadekn author 2/2/2007

Rob,

modify SQL for this purpose:

select ...,

TotalIncome - TotalFixed + TotalVariable + TotalPeriodic as netassets

from ...


That won't write the amount to the field, netassets will it?
-Rob

Sergey Kornilov admin 2/2/2007

No, it doesn't write calculated value to the field.
This code allows you to calculate field value on the fly.

R
renegadekn author 2/2/2007

No, it doesn't write calculated value to the field.

This code allows you to calculate field value on the fly.


Using the code you suggest I'm getting this error

Parse error: syntax error, unexpected '.' in /home/rniles/public_html/test/cccsadmin/include/Budget_events.php on line 8
Thanks

Sergey Kornilov admin 2/2/2007

My code is not related to events.
I'm talking about modifying SQL query on SQL query tab in PHPRunner.

R
renegadekn author 2/2/2007

My code is not related to events.

I'm talking about modifying SQL query on SQL query tab in PHPRunner.


Thanks,
Thant works