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.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.