Calculated Fileds in grid not working

Good Morning

I try to calculate the folllwoiung in a grid (placed this code in onRecord)

{event_density} = {reg_p} / {min_p}

But it is not working , the grid is not displayed. Nothing is displayed.

the type of event_density is percentage the two others are integer

reg_p is a “manual field” and loaded from an other tabele

SELECT count(participant_id) FROM bpmspace_edums.participation
WHERE  event_id = {event_id}  AND`status_participation_id` != 6
ORDER BY participant_id

min_p is also a “manual field”

SELECT min_participants 
FROM course 
WHERE course_id = {course_id} 
ORDER BY min_participants

do i have to use

$sql = ‘SELECT …’;
sc_lookup(tbl_lookup,$sql);
{calc_value} = tbl_lookup[0][0];

Use onInit to get values before form fields are populated. Use onLoad if you need to access existing form field values.
as explained here http://www.scriptcase.net/forum/showthread.php?582-Calculated-Fileds

that would be double work since the sql statement is allready in the filed definition- and they are working

thanks rob

Mhh probably it has nothing to do with the lookup
when i place

{event_density} = 50 + 10

in the onRecord evenet although nothing ist displayed

It wouldn’t be the case that you have to terminate your php lines with ‘;’ would it?

so simple so true !!! thanks :wink:
Note to myself SQL statements don’t need “;” php skripts do :slight_smile: