Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Table events

Events. ProcessRecord

Scroll Prev Next More

Description

In this event you can modify values received from the database or REST API. The event is called right after the record is retrieved from the datasource and before any other processing.

 

This event can be useful when you need to transform received from the external datasource into a format that PHPRunner understands and need to do this on all pages.

Applies to pages

All table-level pages that work with data received from the database or from REST API: List, View, Print, Edit, Export.

Syntax

ProcessRecords($values)

Arguments

$values

an array with values representing a single record received from the database or from REST API.

Return value

no return value

 

Example 1

 

REST API returns dates in epoch format ( number of seconds that have elapsed since January 1, 1970 ) and we need to convert them to a standard database format yyyy-mm-dd hh:mm:ss so the rest of our applications understands it.

 

 

// source datetime: 1344988800
// converted date : 2012-08-15 00:00:00
$dt = new DateTime($values["DateField"]);
$values["DateField"] = $dt->format('Y-m-d H:i:s');

Recommended  sample events

Before record processed

After record processed

View as 'Custom'

See also:

Choose pages screen

Datasource tables

About Database API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software