ChartBlocks / php-ssrs

PHP library for connecting to SSRS over SOAP
MIT License
25 stars 22 forks source link

Class SSRS_Object_ExecutionParameters #24

Closed anchovy closed 8 years ago

anchovy commented 8 years ago

Hi

I've managed to connect to our remote reports server - but specifying parameters is throwing the following error:

FatalErrorException in tempRoutesController.php - Class 'App\Http\Controllers\SSRS_Object_ExecutionParameters' not found"

Current code is:

`

$ssrs = new \SSRS\Report(env('SSRS_ADDRESS'), array('username' => env('SSRS_USER'), 'password' => env('SSRS_PASSWORD')));

$result = $ssrs->loadReport(env('SSRS_REPORT'));
$reportParameters = array(
    'param_1' => '1'
    ,'param_2'=> '1'
);

$parameters = new SSRS_Object_ExecutionParameters($reportParameters);

$ssrs->setSessionId($result->executionInfo->ExecutionID)->setExecutionParameters($parameters);

$output = $ssrs->render('HTML4.0'); // PDF | XML | CSV
echo $output;

`

Searching through the library - I can't see any class named SSRS_Object_ExecutionParameters, any ideas where I'm going wrong?

Regards Ben

anchovy commented 8 years ago

Used the following to overcome this issue:

$ssrs = new \SSRS\Report(env('SSRS_ADDRESS'), array('username' => env('SSRS_USER'), 'password' => env('SSRS_PASSWORD')));

$result = $ssrs->loadReport(env('SSRS_REPORT'));
$ssrs->setSessionId($result->data['ExecutionID']);

$reportParameters = array(
'param_1' => '1'
,'param_2'=> '1'
);

$parameters = $ssrs->setExecutionParameters($reportParameters);

$output = $ssrs->render('HTML4.0'); // PDF | XML | CSV
echo $output;
widiramadhan commented 6 years ago

i got message Call to undefined function env()

rb-cohen commented 6 years ago

Hi @widiramadhan, you would need to install a library to extract your environment variables to use this example. You could try https://packagist.org/packages/rb-cohen/php-env if you aren't using a framework.

Alternatively, just replace the env() bits in the example above for your actual values.