Prepare the data in PHP, register it in the report dictionary, and render the template with those records.

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
$report->engine = StiEngineType::ServerNodeJS;
$report->onBeginProcessData = function (StiDataEventArgs $args) {
    if ($args->connection == 'MyConnectionName')
        $args->connectionString = 'Server=localhost; Database=northwind; UserId=root; Pwd=;';
    if ($args->dataSource == 'MyDataSource')
        $args->queryString = 'SELECT * FROM MyTable';
};
$report->process();
$report->loadFile('reports/SimpleListSQL.mrt');
$report->render();


The event fires on the server as data is processed, so a headless render can query databases securely, with the connection string and query controlled entirely in PHP.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.