Monday, February 20, 2012

Rendering reports using SOAP API vsURL Addressing

Hello,
I have been developing a reporting services application and have had to rely
on rendering using the web service API.
Before I go any further let me explain why we are going this way instead
of using URL addressing.
The client has a couple of reports where the selection criteria can get quite
long and in the past has exceeded the number of characters allowed in the
querystring. This will obvious cause the eport gen to fail.
Ok now that the background is over, here are some things I hope to find out.
First, is there anyway to use the URL addressing via POSTing the variables
to the report server or do all params have to be in the querystring?
Next, since I do not think the POSTing will work, is there any way with SP2
or a hot fix that there is a way to get the total number of pages in a report
that is rendered to HTML? I have found two hacks out there so far. First
the suggestion of rendering the entire report via the API then counting the
number of <HR> tags to ge tthe total number of pages. The second method,
found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_intro_7vqa.asp,
suggests to render the first page of the report as an image then get the
length + 1 of the streamId's parameter.
The first method, may work but I cant imagine it would be good on reports
where there is 50 or 60 pages. The second method does not seem to work for
us. When we fire the code against a report that has two pages it gives us
back a streamId.Length of 5.
Finally, I can not imagine that I am the only one that has had the issue
of not being able to call URL address to get my report due to param length.
Has anyone else encountered this and if so how did they get around it.
Thanks for any guidance,
RichPOST should work.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Rich" <rich@.online.nospam> wrote in message
news:923159632507411681250000@.msnews.microsoft.com...
> Hello,
> I have been developing a reporting services application and have had to
> rely on rendering using the web service API.
> Before I go any further let me explain why we are going this way instead
> of using URL addressing.
> The client has a couple of reports where the selection criteria can get
> quite long and in the past has exceeded the number of characters allowed
> in the querystring. This will obvious cause the eport gen to fail.
> Ok now that the background is over, here are some things I hope to find
> out.
> First, is there anyway to use the URL addressing via POSTing the variables
> to the report server or do all params have to be in the querystring?
> Next, since I do not think the POSTing will work, is there any way with
> SP2 or a hot fix that there is a way to get the total number of pages in a
> report that is rendered to HTML? I have found two hacks out there so far.
> First the suggestion of rendering the entire report via the API then
> counting the number of <HR> tags to ge tthe total number of pages. The
> second method, found here:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_intro_7vqa.asp,
> suggests to render the first page of the report as an image then get the
> length + 1 of the streamId's parameter.
> The first method, may work but I cant imagine it would be good on reports
> where there is 50 or 60 pages. The second method does not seem to work
> for us. When we fire the code against a report that has two pages it
> gives us back a streamId.Length of 5.
> Finally, I can not imagine that I am the only one that has had the issue
> of not being able to call URL address to get my report due to param
> length. Has anyone else encountered this and if so how did they get around
> it.
> Thanks for any guidance,
> Rich
>
>|||I wrote a dumb little function to get the page count... not the most
efficient, but does the job: if you find out a better way of doing it
(supported fully by rs), let me know?
private int FindNumOfPages(string input)
{
string blah = input;
int counter = 1;
int end = blah.Length;
int start = 0;
int at = 0;
int count = 0;
while (start <= end && at > -1)
{
count = end - start;
at = blah.IndexOf("<hr/>", start, count);
if (at == -1)
break;
else
{
counter++;
start = at+1;
}
}
return counter;
}
--
Foober
"Rich" wrote:
> Thanks. So what about my other questions such as getting page count from
> RS API.
> Also if posting works, will the toolbar render correctly? In other words
> will the toolbar just post ot the next page or wil it try to put all the
> params on the querystring.
> Thanks for any additional information.
> Rich
> Hello Lev Semenets [MSFT],
> > POST should work.
> >
> > "Rich" <rich@.online.nospam> wrote in message
> > news:923159632507411681250000@.msnews.microsoft.com...
> >
> >> Hello,
> >>
> >> I have been developing a reporting services application and have had
> >> to
> >> rely on rendering using the web service API.
> >> Before I go any further let me explain why we are going this way
> >> instead
> >> of using URL addressing.
> >> The client has a couple of reports where the selection criteria can
> >> get
> >> quite long and in the past has exceeded the number of characters
> >> allowed
> >> in the querystring. This will obvious cause the eport gen to fail.
> >> Ok now that the background is over, here are some things I hope to
> >> find
> >> out.
> >> First, is there anyway to use the URL addressing via POSTing the
> >> variables to the report server or do all params have to be in the
> >> querystring?
> >>
> >> Next, since I do not think the POSTing will work, is there any way
> >> with
> >>
> >> SP2 or a hot fix that there is a way to get the total number of pages
> >> in a
> >>
> >> report that is rendered to HTML? I have found two hacks out there so
> >> far.
> >>
> >> First the suggestion of rendering the entire report via the API then
> >>
> >> counting the number of <HR> tags to ge tthe total number of pages.
> >> The
> >>
> >> second method, found here:
> >>
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rspr
> >> og/htm/rsp_prog_intro_7vqa.asp,
> >>
> >> suggests to render the first page of the report as an image then get
> >> the
> >>
> >> length + 1 of the streamId's parameter.
> >>
> >> The first method, may work but I cant imagine it would be good on
> >> reports
> >>
> >> where there is 50 or 60 pages. The second method does not seem to
> >> work
> >>
> >> for us. When we fire the code against a report that has two pages it
> >>
> >> gives us back a streamId.Length of 5.
> >>
> >> Finally, I can not imagine that I am the only one that has had the
> >> issue
> >>
> >> of not being able to call URL address to get my report due to param
> >>
> >> length. Has anyone else encountered this and if so how did they get
> >> around
> >>
> >> it.
> >>
> >> Thanks for any guidance,
> >>
> >> Rich
> >>
>
>|||That method sounds a lot better than my method :) Better than rendering the
ENTIRE report first, counting horizontal rules, and then rerendering page 1.
I'll implement that instead.
I saw a post *somewhere* that microsoft was aware of the issue and were
looking into a fix in a "future release". Maybe in SQL2005?
--
Foober
"Rich" wrote:
> Hello Foober,
> Thanks for posting this solution. Here is what I ended up coming up with
> regarding a solution. I added a parameter on the report called "ShowpageCount
> set it to a boolean type with a default of false. I then created a textbox
> whose value was set to "~*" & Globals!TotalPages & "*~". Then I set the
> property of the Hidden to "Not Parameters!ShowPages". So now when I want
> the pages on the report, I can call into this report via the api and set
> the showPages param. I then take the rendered stream and regex it for the
> ~*<number>*~ token somewhere (I dont care where) in the stream and pull that
> number. I then turn around and call the report again without setting that
> param. A hack...yes. Best thing I could thinki of so I did not have to
> render what could be a 60 page report.
> Let me know what you thik of this idea. I just wonder....did they at least
> fix this for us in the new version?
>
> > I wrote a dumb little function to get the page count... not the most
> > efficient, but does the job: if you find out a better way of doing it
> > (supported fully by rs), let me know?
> >
> > private int FindNumOfPages(string input)
> > {
> > string blah = input;
> > int counter = 1;
> > int end = blah.Length;
> > int start = 0;
> > int at = 0;
> > int count = 0;
> > while (start <= end && at > -1)
> > {
> > count = end - start;
> > at = blah.IndexOf("<hr/>", start, count);
> > if (at == -1)
> > break;
> > else
> > {
> > counter++;
> > start = at+1;
> > }
> > }
> > return counter;
> > }
> > "Rich" wrote:
> >
> >> Thanks. So what about my other questions such as getting page count
> >> from RS API.
> >>
> >> Also if posting works, will the toolbar render correctly? In other
> >> words will the toolbar just post ot the next page or wil it try to
> >> put all the params on the querystring.
> >>
> >> Thanks for any additional information.
> >>
> >> Rich
> >>
> >> Hello Lev Semenets [MSFT],
> >>
> >> POST should work.
> >>
> >> "Rich" <rich@.online.nospam> wrote in message
> >> news:923159632507411681250000@.msnews.microsoft.com...
> >> Hello,
> >>
> >> I have been developing a reporting services application and have
> >> had
> >> to
> >> rely on rendering using the web service API.
> >> Before I go any further let me explain why we are going this way
> >> instead
> >> of using URL addressing.
> >> The client has a couple of reports where the selection criteria can
> >> get
> >> quite long and in the past has exceeded the number of characters
> >> allowed
> >> in the querystring. This will obvious cause the eport gen to fail.
> >> Ok now that the background is over, here are some things I hope to
> >> find
> >> out.
> >> First, is there anyway to use the URL addressing via POSTing the
> >> variables to the report server or do all params have to be in the
> >> querystring?
> >> Next, since I do not think the POSTing will work, is there any way
> >> with
> >>
> >> SP2 or a hot fix that there is a way to get the total number of
> >> pages in a
> >>
> >> report that is rendered to HTML? I have found two hacks out there
> >> so far.
> >>
> >> First the suggestion of rendering the entire report via the API
> >> then
> >>
> >> counting the number of <HR> tags to ge tthe total number of pages.
> >> The
> >>
> >> second method, found here:
> >>
> >> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rs
> >> pr og/htm/rsp_prog_intro_7vqa.asp,
> >>
> >> suggests to render the first page of the report as an image then
> >> get the
> >>
> >> length + 1 of the streamId's parameter.
> >>
> >> The first method, may work but I cant imagine it would be good on
> >> reports
> >>
> >> where there is 50 or 60 pages. The second method does not seem to
> >> work
> >>
> >> for us. When we fire the code against a report that has two pages
> >> it
> >>
> >> gives us back a streamId.Length of 5.
> >>
> >> Finally, I can not imagine that I am the only one that has had the
> >> issue
> >>
> >> of not being able to call URL address to get my report due to param
> >>
> >> length. Has anyone else encountered this and if so how did they get
> >> around
> >>
> >> it.
> >>
> >> Thanks for any guidance,
> >>
> >> Rich
> >>
>
>

No comments:

Post a Comment