Comments (7)
If you call loadReport() you should get back lots of information on the report, including the parameters. Each parameter should have a required flag on it.
Something like this:
<?php
require(__DIR__ . '/../vendor/autoload.php');
$options = array(
'username' => 'testing',
'password' => 'password'
);
$ssrs = new \SSRS\Report('http://localhost/reportserver/', $options);
$result = $ssrs->loadReport('/Reports/Reference_Report');
$parameters = $result->getReportParameters();
from php-ssrs.
How do you retrieve conditional parameters? For example: based on the parameter chosen in one field, it updates the available params in another field. I'd prefer to default this value if I can before loading the list of parameters the first time.
Is this possible?
from php-ssrs.
IIRC you have to update the parameters, then grab the 'updated' conditional parameters from SSRS. I don't think you can get a list of everything right off the bat.
It has been a while, but we did something like this, where $knownValues
are the default values or the previously submitted values:
$executionParameters = new SSRS_Object_ExecutionParameters($knownValues);
$newExecutionInfo = $ssrs->setExecutionParameters($executionParameters);
$ssrs->setSessionId($newExecutionInfo->ExecutionID);
$newParameters = $newExecutionInfo->getReportParameters();
// here we had a form generator, eventually populating a HTML form based off the available parameters and values
$formGenerator->generate($newParameters);
$output = $ssrs->render('HTML4.0'); // PDF | XML | CSV
from php-ssrs.
Thanks for the response. Unfortunately this code doesn't work. Here's the full snippet of what I tried:
This code fails with "Session ID not set"
// You need to connect to the server and load your report
$ssrs = new \SSRS\Report('http://myserver/ReportServer', array('username' => 'user', 'password' => 'password'));
$report = $ssrs->loadReport('/Folder/Report');
// Add execution parameters from submission
$execution_params = new \SSRS\Object\ExecutionParameters($requestedFilters);
$new_report = $ssrs->setExecutionParameters($execution_params);
$ssrs->setSessionId($new_report->ExecutionID);
// Params to send to the form view
$available_params = $new_report->getReportParameters();
Your other examples in the wiki indicate that the session id has to be set in the same statement as the setExecutionParameters
but if I use that session ID, the parameters I get at the end are just the defaults, not reflective of the data I sent for the report.
// If I instead use the previous session ID:
$new_report = $ssrs->setSessionId($report->ExecutionID)->setExecutionParameters($execution_params);
// Do not reflect the values submitted
$available_params = $new_report->getReportParameters();
// Just for giggles and grins
$new_report->executionInfo->Parameters; // this is null
Here's an example -- you can see value is null even though I am sending a value and the report executes as if a value has been sent.
array:9 [▼
0 => ReportParameter {#1181 ▼
+name: "parForecastDate"
+value: null
+data: array:13 [▶]
}
1 => ReportParameter {#1555 ▼
+name: "parMonths"
+value: null
+data: array:13 [▶]
}
2 => ReportParameter {#1561 ▼
+name: "parType"
+value: null
+data: array:13 [▶]
}
]
The issue with this is that sending these available parameters to our form builder, and one of them has no options available because it's not showing a value for a dependency.
At this point I'm stumped and I might have to build the form filters manually and just send the data to get the report.
from php-ssrs.
If the execution ID isn't updated any subsequent requests won't reflect your submission. The execution ID from SSRS is like a state marker.
In your example, where you keep the old session ID, you'll get back the state before you submitted anything.
Unfortunately I don't have access to an SSRS server at the moment to run some tests, but the code should work. Here is a fuller example from the snippet I sent, you'll see we keep updating the session ID to the latest execution ID:
$ssrs = new SSRS_Report('http://testing/reportserver/', $options);
$executionInfo = $ssrs->loadReport($reportName);
$ssrs->setSessionId($executionInfo->ExecutionID);
$executionParameters = new SSRS_Object_ExecutionParameters($knownValues);
$newExecutionInfo = $ssrs->setExecutionParameters($executionParameters);
$ssrs->setSessionId($newExecutionInfo->ExecutionID);
$newParameters = $newExecutionInfo->getReportParameters();
// here we had a form generator, eventually populating a HTML form based off the available parameters and values
$formGenerator->generate($newParameters);
$output = $ssrs->render('HTML4.0'); // PDF | XML | CSV
Hopefully that helps a bit? Sounds like its almost there...
from php-ssrs.
from php-ssrs.
Phew, good to hear! :)
from php-ssrs.
Related Issues (20)
- Content-Length header must not be set HOT 2
- ListChildren is not a valid method HOT 2
- Toggle Item HOT 1
- SSRS_SOAP_EXCEPTION not found HOT 1
- Toolbar not showing HOT 4
- Pagination? HOT 6
- error handling on non-xml responses HOT 3
- String could not be parsed as XML HOT 2
- Soap Fault -Could not connect to host
- Class SSRS_Object_ExecutionParameters HOT 3
- _cacheExpiry not set HOT 1
- Cached WSDL file is the same for every request HOT 4
- CURL error: Could not resolve proxy HOT 3
- Back to original link when click report drill down HOT 11
- SOS ! String could not be parsed as XML HOT 6
- Pass DataSource Credentials? HOT 1
- I am unable to create connection with SSRS server - Fatal error: Class 'SSRS\Soap\NTLM' not found HOT 2
- Include images from ssrs report to html page HOT 2
- how can i run this code
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-ssrs.