SQL queries can use parameters whose values you set on the server. This example supplies a parameter value in the onBeginProcessData event.

Supplying values. Create or resolve the input parameter, assign its value before rendering, and pass the prepared report to the viewer or export routine.
$viewer->onBeginProcessData = function (StiDataEventArgs $args) {
    if ($args->connection == 'MySQL')
        $args->connectionString = 'Server=localhost; Database=northwind; UserId=root; Pwd=;';
    if ($args->dataSource == 'customers' && count($args->parameters) > 0) {
        $args->parameters['Country']->value = "Germany";
    }
};
$viewer->process();


The event exposes the query's parameters by name; setting their values on the server lets you filter the data securely, for example limiting a customers report to a specific country.

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