ChartBlocks / php-ssrs

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

Pagination? #19

Closed anakinjay closed 9 years ago

anakinjay commented 9 years ago

first thanks for this, it's fantastic and saved me a TON of time!!

Just a quick question about pages... some of our reports have 50 pages or more. Is there any good way to separate them out? Even if it's just on the front end, I just don't want to make people have to scroll through 50 pages with a mouse wheel haha.

Thanks again!

rb-cohen commented 9 years ago

Hey,

Definitely! In the device info, set 'section' to 1 to bring out the first page, 2 to bring out the second, etc.

In $executionInfo from the examples you can get the total number of pages. This isn't always accurate but should be close.

If none of this makes sense I can try to post an example.

Thanks,

Arron On 18 Jun 2015 21:56, "anakinjay" notifications@github.com wrote:

first thanks for this, it's fantastic and saved me a TON of time!!

Just a quick question about pages... some of our reports have 50 pages or more. Is there any good way to separate them out? Even if it's just on the front end, I just don't want to make people have to scroll through 50 pages with a mouse wheel haha.

Thanks again!

— Reply to this email directly or view it on GitHub https://github.com/ChartBlocks/php-ssrs/issues/19.

anakinjay commented 9 years ago

If you could work up a simple example I'd greatly appreciate it! I took a peek at the source code and tried using getPageCount() on the executionInfo object, but its always zero. I'm assuming because I'm doing something wrong.

rb-cohen commented 9 years ago

Hmm, getPageCount() should do it. Did you set the section to 1 in the device info? It might return a page count of 0 if you ask for all pages (the default).

On 19/06/2015 15:28, anakinjay wrote:

If you could work up a simple example I'd greatly appreciate it! I took a peek at the source code and tried using getPageCount() on the executionInfo object, but its always zero. I'm assuming because I'm doing something wrong.

— Reply to this email directly or view it on GitHub https://github.com/ChartBlocks/php-ssrs/issues/19#issuecomment-113530970.

anakinjay commented 9 years ago

Hmm, well now I'm really confused.

the device info array is in the render method right? I'm running getPageCount off of the executionInfo object created from the loadReport call.

    $result = $ssrs->loadReport($path);

        $parameters = new \SSRS\Object\ExecutionParameters($params);
        $ssrs->setSessionId($result->executionInfo->ExecutionID)->setExecutionParameters($parameters);
        $output = $ssrs->render('HTML4.0');

So the above code works to display the report.

What I'm trying to do based on my very limited understanding of the framework:


    $result = $ssrs->loadReport($path); 

        $parameters = new \SSRS\Object\ExecutionParameters($params);
        $executionInfo = $ssrs->setSessionId($result->executionInfo->ExecutionID)->setExecutionParameters($parameters);

        $deviceInfo = array('section'=>1);
        $output = $ssrs->render('HTML4.0',$deviceInfo);

        $pageCount = $executionInfo->getPageCount();

Page count is always zero. There seems to be a disconnect between the executionInfo object and the actual report render that I'm not understanding.

thanks for the help!

rb-cohen commented 9 years ago

Ah OK, I see. After the render you need to get the latest execution info.

So:

$output = $ssrs->render('HTML4.0', $deviceInfo); $executionInfo = $ssrs->getExecutionInfo();

Or the ReportOutput class has a copy of the executionInfo after the render so I think you could do: $executionInfo = $output->executionInfo;

On 19/06/2015 15:56, anakinjay wrote:

Hmm, well now I'm really confused.

the device info array is in the render method right? I'm running getPageCount off of the executionInfo object created from the loadReport call.

| $result = $ssrs->loadReport($path);

     $parameters = new \SSRS\Object\ExecutionParameters($params);
     $ssrs->setSessionId($result->executionInfo->ExecutionID)->setExecutionParameters($parameters);
     $output = $ssrs->render('HTML4.0');

So the above code works to display the report.

What I'm trying to do based on my very limited understanding of the source code:

     $parameters = new \SSRS\Object\ExecutionParameters($params);
     $executionInfo = $ssrs->setSessionId($result->executionInfo->ExecutionID)->setExecutionParameters($parameters);

     $deviceInfo = array('section'=>1);
     $output = $ssrs->render('HTML4.0',$deviceInfo);

     $pageCount = $executionInfo->getPageCount();

Page count is always zero. There seems to be a disconnect between the executionInfo object and the actual report render that I'm not understanding.

thanks for the help!

— Reply to this email directly or view it on GitHub https://github.com/ChartBlocks/php-ssrs/issues/19#issuecomment-113538047.

anakinjay commented 9 years ago

Beautiful! That was it, thank you so much!