Choose your database:
AnySQL
MySQL
MS SQL Server
PostgreSQL
SQLite
Firebird
Oracle
SQL Anywhere
DB2
MaxDB

Subscribe to our news:
Partners
Testimonials
Steven Langfield: "I wanted to drop you a mail to say how freaking AMAZING your software is. It will be the best £100 I have ever spent. I have still to read all your documentation to take full advantage but what you have created is truly amazing".
Gabriela Arsene: "MySQL PHP Generator is really excellent! A very useful, easy to use tool and above all it is free, saving a lot of time and money to a developer! Great job! Congratulations to all the people who work at this project".

More

Add your opinion

PHP Generator for MySQL online Help

Prev Return to chapter overview Next

OnCalculateFields

This event occurs whenever the values of calculated columns are (re)computed in read-only views (List, Print, Export, etc). Live examples.

 

Signature:

function OnCalculateFields($rowData, &fieldName, &$value)

 

Parameters:

$rowData

An associative array of values of the currently processed row

$fieldName

The name of the currently processed calculated column

$value

The value to be assigned to the column

 

Example 1:

This code snippet sets the value of the full_name column according to the values stored in the first_name and last_name columns.

 

if ($fieldName == 'full_name') {

    $value = $rowData['first_name'] . ' ' . $rowData['last_name'];

 

Example 2:

This code snippet sets the value of the age column according to the birthday.

 

if ($fieldName == 'age') {

    $dateOfBirth = new DateTime($rowData['birthday']);

    $dateInterval = $dateOfBirth->diff(new DateTime());

    $value = $dateInterval->format('%y');

}

 

See also:

OnCalculateControlValues.



Prev Return to chapter overview Next