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

Subscribe to our news:
Partners
Testimonials
Patrick Biegel: "Thanks a lot for your fast reply and the great solution! It works now and that's really important! The PHP Generator for MySQL is a great software".
David Lantz: "Thank you, this is by far the simplest, and most friendly utility for building db record system I have ever used. I wish I could get my systems guys at the office to purchase this for our company would be so very helpful and speed up a lot of work. I for one have used it for everything from a simple inventory record of my house, to a members record for my church just little pet projects and a test bed to test my own db builds and theories before having to hand code at the office..... it is a lot of fun to work with".

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