Setting Report Variables on the Server-Side
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.Report variables can be assigned on the server before rendering — the
Set variable values in PHP.
How it works. Values chosen on the server are injected into the report generator, so the client renders with data it never had to supply.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

onPrepareVariables event supplies values that flow into the report generator.Set variable values in PHP.
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';
$viewer->onPrepareVariables = function (StiVariablesEventArgs $args) {
if (count($args->variables) > 0) {
$args->variables['Name']->value = 'Maria';
$args->variables['Surname']->value = 'Anders';
$args->variables['BirthDay']->value = '1982-03-20 00:00:00';
}
};
$viewer->process();
$report->loadFile('../reports/Variables.mrt');
$viewer->report = $report;onPrepareVariables— server event that receives the report's variables before rendering.$args->variables['Name']->value— assign each value by name; types must match those defined in the template.
How it works. Values chosen on the server are injected into the report generator, so the client renders with data it never had to supply.
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
