Global helpers

Global helpers are used for criterion, data cell and dimension custom codes. If you need a global class, or helper, create it as global helper and use anywhere you want. In DAP, there are three types of global helpers. Global Search Helper, Global Report Helper and Global Chart Helper.

Global helpers code editor.

Global helpers is written in PHP. These helper are php classes. You must create clas methods. Mostly, helper methods are written for database processes, so you should have a bit of Zend Database Library and ORM.

Using Global Helpers

$GlobalHelperObject = Loader::srcHelper('nodeName') method is used. To create a global helper object;

## Example, in data cell custom code editor.
$reportGlobalHelperObject = Loader::srcHelper('Report');

## Now you can access all global report helper methods by using $reportGlobalHelperObject object.

## Other global helpers
$searchGlobalHelperObject = Loader::srcHelper('Search'); // GlobalSearchHelper
$reportGlobalHelperObject = Loader::srcHelper('Chart'); // GlobalChartHelper

Accessing Database Library Object

## to access database library object in global helpers
$dbObject = Loader::db();

Creating Select Object

$select = $dbObject->select(new Zend\Db\Sql\TableIdentifier('table_name', 'database_name'));

Creating SQL Query

$where = $this->db->where();
$where = $where->nest();
$where->in('field', $ids);
$where = $where->unnest();
$select->where($where);
$result = $this->db->query($select)->toArray();

For more information about Zend DB go to Zend Database Library.