Wednesday, March 28, 2012
Resetting the pagenumber at new every group
reset the page number to 1 whenever the customer changes
(i.e. pagenumbering on group-level). The whole print-job
encompasses hundreds of pages.
How can I do this?This cannot be done in the current release.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Daniel Aebi" <maus2001@.bluewin.ch> wrote in message
news:Ompzea5eEHA.2544@.TK2MSFTNGP10.phx.gbl...
> I need to print multi-paged invoices. Therefore I'd like to
> reset the page number to 1 whenever the customer changes
> (i.e. pagenumbering on group-level). The whole print-job
> encompasses hundreds of pages.
> How can I do this?
>
>
Resetting Page numbers on each Group
I have designed a report on Invoice details and grouped by Invoice Numbers
and also applied page break on this group. I need to reset page numbers on
each Invoice number.
Is this possible?
Anyone know how to do this?
I am using SQL Server 2000 Reporting Services.
Thnx
DimpuHi Dimpu,
Not supported in RS 2000, but there is a workaround using a little code
- check out Chris Hay's RS Sleazy Hacks BLOG entry at
http://blogs.msdn.com/chrishays/archive/2006/01/05/ResetPageNumberOnGroup.aspx
It works great!
MattA
www.reportarchitex.com|||Hi Matt
It worked! Many thnx for your valuable information.
Regards
dimpu
"MattA" wrote:
> Hi Dimpu,
> Not supported in RS 2000, but there is a workaround using a little code
> - check out Chris Hay's RS Sleazy Hacks BLOG entry at
> http://blogs.msdn.com/chrishays/archive/2006/01/05/ResetPageNumberOnGroup.aspx
>
> It works great!
> MattA
> www.reportarchitex.com
>
Resetting Page Number in SQL Reporting Services
Thanks,
DennyDenny:
Try this blog that I found on this same group.
http://blogs.msdn.com/bwelcker/archive/2005/05/19/420046.aspx
Sher
Denny wrote:
> Does anyone know of a way to reset page numbering when the group changes?
> Thanks,
> Denny
Resetting page counter
ThanksOne way to do this is to format the section to add a new page after each group and go into the formula and type <> OnLastRecord. This will give a new page after each record (except for the last page). You can then use a running total that is evaluated on change of that group. If you show the running total at the bottom of the Crystal Report (http://www.shelko.com) page, you will get the effect that you are looking for.sql
Monday, March 26, 2012
Reset Total page number in a group
I know how to reset the page numbers with each group, but how do you reset the total page number within each group.
EX. Code for page of total pages
="Page " & Globals.PageNumber & " of " & Globals.TotalPages
EX. Code to reset within a group
Custom Code:
Shared offset as Integer
Shared currentgroup as object
Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
If not (group = currentgroup)
offset = pagenumber - 1
currentgroup= group
end if
return pagenumber - offset
end function
=Code.GetGroupPageNumber(ReportItems!Category.Value(grouping),Globals!PageNumber)
What I need is code for a combination of the two...to display code for page of total pages that resets within a group.
Any help is greatly appreciated.
Thanks!
Hello,
I am facing the exact same need. Anyone solve this?
Reset Total page number in a group
I know how to reset the page numbers with each group, but how do you reset the total page number within each group.
EX. Code for page of total pages
="Page " & Globals.PageNumber & " of " & Globals.TotalPages
EX. Code to reset within a group
Custom Code:
Shared offset as Integer
Shared currentgroup as object
Public Function GetGroupPageNumber(group as Object, pagenumber as Integer) as Object
If not (group = currentgroup)
offset = pagenumber - 1
currentgroup= group
end if
return pagenumber - offset
end function
=Code.GetGroupPageNumber(ReportItems!Category.Value(grouping),Globals!PageNumber)
What I need is code for a combination of the two...to display code for page of total pages that resets within a group.
Any help is greatly appreciated.
Thanks!
Hello,
I am facing the exact same need. Anyone solve this?
Friday, March 23, 2012
Reset PageNumber On Group Change
in a list. PageNumber works well for overall numbering, but not inside the
group, furthermore, I cannot access the current pagenumber from inside the
group.
I am using RS 2005.Add this to your report code:
Shared offset as Integer
Public Function GrpPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End if
Return pagenumber - offset
End Function
Then place a text box in the page footer with this expression - assuming you
have the group set with page break at end and have labeled your Group cell.
="Page " & Code.GrpPN(Not(ReportItems!txtGroup.Value Is Nothing),
Globals!PageNumber)
Hope that helps (this was in 2000)
--
Allison
"Rick" wrote:
> I need to reset the page number when a group changes. The group is controlled
> in a list. PageNumber works well for overall numbering, but not inside the
> group, furthermore, I cannot access the current pagenumber from inside the
> group.
> I am using RS 2005.
Reset Page Numbering Total
For example
Group A - 3 pages
Group B - 4 pages
So for group B on the 4th page it will start with 1, using the following
code this does this fine
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
I am wanting to do this for the total of the pages as well so for example
page 4 would show as 1 of 4 instead of 1 of 7
How do I get this working for the total pages as well as the individual pagesI have the same problem, did you come up with any solution?
"Mark Stanley" wrote:
> I am wanting to reset the page number on the break of each group.
> For example
> Group A - 3 pages
> Group B - 4 pages
> So for group B on the 4th page it will start with 1, using the following
> code this does this fine
> Shared offset As Integer
> Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
> If reset
> offset = pagenumber - 1
> End If
> Return pagenumber - offset
> End Function
> I am wanting to do this for the total of the pages as well so for example
> page 4 would show as 1 of 4 instead of 1 of 7
> How do I get this working for the total pages as well as the individual pages|||Jim,
See my earlier posting in this thread.
It's not a simple solution but it might help.
Chris
JIM.H. wrote:
> I have the same problem, did you come up with any solution?
> "Mark Stanley" wrote:
> > I am wanting to reset the page number on the break of each group.
> >
> > For example
> >
> > Group A - 3 pages
> > Group B - 4 pages
> >
> > So for group B on the 4th page it will start with 1, using the
> > following code this does this fine
> >
> > Shared offset As Integer
> >
> > Public Function GetPN(reset As Boolean, pagenumber As Integer) As
> > Integer If reset
> > offset = pagenumber - 1
> > End If
> > Return pagenumber - offset
> > End Function
> >
> > I am wanting to do this for the total of the pages as well so for
> > example page 4 would show as 1 of 4 instead of 1 of 7
> >
> > How do I get this working for the total pages as well as the
> > individual pages|||Hi Chris,
Did you mean you attached something in the previous message, I am using web
interface and do not know how to see attachments.
"Chris McGuigan" wrote:
> Jim,
> See my earlier posting in this thread.
> It's not a simple solution but it might help.
> Chris
>
> JIM.H. wrote:
> > I have the same problem, did you come up with any solution?
> >
> > "Mark Stanley" wrote:
> >
> > > I am wanting to reset the page number on the break of each group.
> > >
> > > For example
> > >
> > > Group A - 3 pages
> > > Group B - 4 pages
> > >
> > > So for group B on the 4th page it will start with 1, using the
> > > following code this does this fine
> > >
> > > Shared offset As Integer
> > >
> > > Public Function GetPN(reset As Boolean, pagenumber As Integer) As
> > > Integer If reset
> > > offset = pagenumber - 1
> > > End If
> > > Return pagenumber - offset
> > > End Function
> > >
> > > I am wanting to do this for the total of the pages as well so for
> > > example page 4 would show as 1 of 4 instead of 1 of 7
> > >
> > > How do I get this working for the total pages as well as the
> > > individual pages
>|||Jim,
Here is the contents of the file;
----
Unfortunately, there's currently no good way to build a table of
contents.
And even adding defined execution order isn't going to help, since
pagination happens as a completely separate step from the rest of the
report. This is because you can request the same report with different
page
size/margin settings (and even an entirely different rendering target,
which
could radically change pagination). Under normal circumstances, we don't
want to force reexecution of the entire report just because you change
your
margins.
To handle table of contents type operations, we're going to (eventually)
have to implement an entirely new mode wherein we know that the body of
the
report contains references to page numbers, which will force the entire
report to reexecute if pagination information changes.
In the mean time, there's no general solution for the table of contents
problem.
But... Since you're doing this in a batch once a month, you may not
need a
fully general solution.
Without further ado, here's Sleazy Hack #792 ("Simulating Table of
Contents
in Batch Reporting Scenarios"):
1. Write a custom assembly containing a class that can write rows to a
TableOfContents table in your database.
Have shared methods for both initializing the TOC and writing a new
row
to the TOC.
Note: Don't forget to give it database permissions in the CAS file
when
you deploy it to your server.
See the documentation for details on custom assemblies.
2. In the Code section of the report, call the TOC initialization in
the
OnInit() event.
3. At the start of each section you want to appear in your TOC, put a
hidden textbox that contains the label you want to appear in your TOC.
4. In the page header, put a hidden textbox with something like the
following expression:
=Code.MyTOCClass.AddToTOC(Globals.PageNumber,ReportItems!Textbox1.Value
& ReportItems!Textbox2.Value & ReportItems!Textbox3.Value)
Texbox1, Textbox2 and Textbox3 are the names of the hidden textboxes
from step 3 (since only one will appear on any given page, the rest
will be
empty)
5. Add a dataset to your report which selects from the TableOfContents
table
6. Display the results of the TOC data set in a table at the end of
your
report*
7. Run the report twice. The first time will initialize the TOC. The
second time will use the values from the previous run.
* If you want it at the beginning, you'll either need to run the report
three times (the first to get some rows into the TOC table, the second
to
get the numbers populated correctly and the third to use those numbers)
or
you'll need to make sure the TOC table has the right number of rows to
begin
with (perhaps by not emptying it from the previous month) otherwise your
page numbers will be incorrect due to the TOC pushing things around.
This
isn't an issue if your TOC is only one page long and has PageBreakAtEnd,
however.
JIM.H. wrote:
> Hi Chris,
> Did you mean you attached something in the previous message, I am
> using web interface and do not know how to see attachments.
> "Chris McGuigan" wrote:
> > Jim,
> > See my earlier posting in this thread.
> > It's not a simple solution but it might help.
> >
> > Chris
> >
> >
> > JIM.H. wrote:
> >
> > > I have the same problem, did you come up with any solution?
> > >
> > > "Mark Stanley" wrote:
> > >
> > > > I am wanting to reset the page number on the break of each
> > > > group.
> > > >
> > > > For example
> > > >
> > > > Group A - 3 pages
> > > > Group B - 4 pages
> > > >
> > > > So for group B on the 4th page it will start with 1, using the
> > > > following code this does this fine
> > > >
> > > > Shared offset As Integer
> > > >
> > > > Public Function GetPN(reset As Boolean, pagenumber As Integer)
> > > > As Integer If reset
> > > > offset = pagenumber - 1
> > > > End If
> > > > Return pagenumber - offset
> > > > End Function
> > > >
> > > > I am wanting to do this for the total of the pages as well so
> > > > for example page 4 would show as 1 of 4 instead of 1 of 7
> > > >
> > > > How do I get this working for the total pages as well as the
> > > > individual pages
> >
> >|||Yes there was an attachment. You'll need a "proper" newsreader - I
recommend XanaNews, which can be downloaded at
http://www.wilsonc.demon.co.uk/d9xananews.htm
I've put the contents in another post for you.
Chris
JIM.H. wrote:
> Hi Chris,
> Did you mean you attached something in the previous message, I am
> using web interface and do not know how to see attachments.
> "Chris McGuigan" wrote:
> > Jim,
> > See my earlier posting in this thread.
> > It's not a simple solution but it might help.
> >
> > Chris
> >
> >
> > JIM.H. wrote:
> >
> > > I have the same problem, did you come up with any solution?
> > >
> > > "Mark Stanley" wrote:
> > >
> > > > I am wanting to reset the page number on the break of each
> > > > group.
> > > >
> > > > For example
> > > >
> > > > Group A - 3 pages
> > > > Group B - 4 pages
> > > >
> > > > So for group B on the 4th page it will start with 1, using the
> > > > following code this does this fine
> > > >
> > > > Shared offset As Integer
> > > >
> > > > Public Function GetPN(reset As Boolean, pagenumber As Integer)
> > > > As Integer If reset
> > > > offset = pagenumber - 1
> > > > End If
> > > > Return pagenumber - offset
> > > > End Function
> > > >
> > > > I am wanting to do this for the total of the pages as well so
> > > > for example page 4 would show as 1 of 4 instead of 1 of 7
> > > >
> > > > How do I get this working for the total pages as well as the
> > > > individual pages
> >
> >
Reset Page count, use distinctcount() for page number, or SPROC cursor to reset page numbe
What the user wants is on the beginning of another unique ID, which causes a new page to be started, to have the page count restart to 1.
So, if I have 3 UniqueIDs for all 20 pages, and the first, IDAA, is 10 pages long, the second, IDBB, is 4 pages long, and the third, IDCC, is 6 pages long, then the page numbering would be as:
1-10 for IDAA
1-4 for IDBB
1-6 for IDCC
I've been told to set a cursor in a SP that determines what page I'm on and then passses this to the result set as a column. This is then set in a group to control page breaks. How could I do this? I'm not very familiar with SPROC cursors.
I know how to do this scenario in Crystal Reports, but am trying to figure it out here with either a page count formula, or some type of distinct count().
Thanks!
This is what I've tried so far, but it resets on every page.
So, each page is 1 even if the Unique ID spans 2-3 pages.
I only need it to reset on a new field grouping of the list object.
Here's the VB code for the report:
Shared offset As Integer
Public Function GetPN(reset As Boolean, pagenumber As Integer) As Integer
If reset
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
***************************
In the header, I have a textbox named "tag"
In the footer, I've got the following expression:
="Unique ID Page: " & Code.GetPN(Not(ReportItems!tag.Value Is Nothing),Globals!PageNumber)
Blank
|||My fault...I had the textbox "tag" in the page header and not in the list object itself.
It works!
Thanks!
Reset page # after a "specific" group
the above custom code works when reset is needed on change of each
group, How do I modify this code to reset pagenumber after a particular
group say "group 3".Shared offset as Integer
Shared currentgroup as Object
Public Function GetGroupPageNumber(group as Object, pagenumber as
Integer) as Object
If Not (group = currentgroup)
offset = pagenumber - 1
End If
Return pagenumber - offset
End Function
The above code works!
googlerptgsvcs wrote:
> http://blogs.msdn.com/chrishays/archive/2006/01/05/ResetPageNumberOnGroup.aspx
> the above custom code works when reset is needed on change of each
> group, How do I modify this code to reset pagenumber after a particular
> group say "group 3".sql
Monday, March 12, 2012
Requesting it(PK) after saving data with auto Prim.Key
I have a page for saving a "home" data. As the page unloads I willredirect the user to the page on which he can add the photos to this"home".
Well I structured my photo adding page with first requesting the "homeID" which is an auto Integer (PK).
Because it's renaming the uploaded photos with the homeID and _01, _02...
Because of that i need to send the user to the photo adding page with "response.redirect.....aspx?homeID=....
homeID= ?
But I don't know how to get the homeID value, that the SQL Server automaticly selects for the data. As it is just saving it...
Thanks a lot.If you are using Stored Procedures, make an output parameter for your new ID, like
@.NewHomeId INT OUTPUT
then right after you do your insert
do
SET @.NewHomeId = SCOPE_IDENTITY()
and the value will be returned with the parameters. on the data layer, you can do
(assuming you output parmetere is the last in the params)
int val = (int)parms[parms.length - 1].Value;
Friday, March 9, 2012
Request a web page from SQL Server
I want to request a webpage from sql server every hour.
I tried to make a job which contains a single ActiveX step.
I select VBScript and type
Dim Http
Set Http = CreateObject("Microsoft.XMLHTTP")
Http.Open "GET", "http://localhost/updater_watch.aspx", False
Http.Send
Set Http = Nothing
I set a schedule and on every execution I get an error in the event log.
Event Type: Warning
Event Source: SQLSERVERAGENT
Event Category: Job Engine
Event ID: 208
Date: 8/11/2003
Time: 8:15:00 PM
User: N/A
Computer: NEXUS
Description:
SQL Server Scheduled Job 'updater' (0x444D7F519E70534C9EF81B1570382AEE) - Status: Failed - Invoked on: 2003-08-11 20:15:00 - Message: The job failed. The Job was invoked by Schedule 1 (s1). The last step to run was step 1 (invoke).
Is this the right way to do this task? When I execute the VBScript without the sql server, it runs without a problem.
Thanks, PanayotWhy not set it up as a ongoing job?|||Thanks for the reply garrydawkins,
that is what I have done.
I open eterprise manager and go to management-sql server agent-jobs-new job.
Then create the job, set a its type to activex, make a schedule to execute it every hour. it executes but exits with error. I suspect that it cannot create the xmlhttp object properly in the VB code.
If I only leave two simple statements:
dim somevar
set somevar = nothing
then the job exits with success.
Tuesday, February 21, 2012
Repost - How to reset page numbers in PDF Report
Looking for ideas on this one. Would like a report (single pdf file) whose page numbers would be say 1 of 5 and then 1 of 6, etc.. The page number resets would be based on the changing value of some field like summarybillnumber.
Any help/ideas would be appreciated.
ThanksAdd this to the Code property of the report:
shared offset as integer
public function GetPN(reset as boolean, pagenumber as integer) as integer
if reset
offset = pagenumber - 1
end if
return pagenumber - offset
end function
Use the function in the page number expression, basing the reset property on
the presence of something that only appears on the first page of the group.
For example:
="Page " & Code.GetPN(ReportItems!tag.Value = "Tag",Globals!PageNumber)
Note: To make this work, the offset member variable must be declared as
shared. This means the report cannot be run multiple times simultaneously,
otherwise the separate runs will smash the shared member variable's value.
In addition, failure to access the pages sequentially will have unexpected
results (since the shared offset member variable will be set out of order).
The only way to use this hack is to schedule runs of the report and save off
the rendered results. Users cannot run the report live or even from
snapshot history, since pagination occurs when the report is rendered, not
when the snapshot is taken.
The ability to conditionally reset page numbering on specific page breaks,
such as group page breaks, is on our wishlist for a future version, but this
feature is not likely to make it into SQL 2005.
Brian Welcker
Group Program Manager
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"chanley54" <chanley54@.discussions.microsoft.com> wrote in message
news:BDDF14C9-ACA0-4F8B-98BB-91839AAB6644@.microsoft.com...
> Hello,
> Looking for ideas on this one. Would like a report (single pdf file)
> whose page numbers would be say 1 of 5 and then 1 of 6, etc.. The page
> number resets would be based on the changing value of some field like
> summarybillnumber.
> Any help/ideas would be appreciated.
> Thanks
>
Repost - Forms Auth and the ReportServer web
logon page for the Reports web and and a logon page for the ReportServer
web. The page displays a
company logo, textboxes to enter credentials, logon button, etc. Nothing
extremely fancy.
The issue is this. When I navigate to the Reports web (Report Manager) the
logon page displays with the logo. When I navigate to the
ReportServer web, the logo image doesn't show.
What gives?
--
Adrian Maull
[MCP]Adrian M. wrote:
> The issue is this. When I navigate to the Reports web (Report
> Manager) the logon page displays with the logo. When I navigate to
> the
> ReportServer web, the logo image doesn't show.
> What gives?
It seems that you use a wrong virtual path to your image (i.e.
/images/logo.gif)
Try to use a "full" virtual path (i.e. http://localhost/images/logo.gif)
regards
frank
ReportViewer's checked dropdown list control?
I would like to create my own parameter area for my reports which are displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control (i.e. I have the ShowParameterPrompts property on my Report Viewer control set to False).
I would like to use the Checked Dropdown List control that allows you to check off each item individually or to check the (Select All) option for my multi-valued parameters.
Is there a way I can create an instance of this checked dropdown control or is there another component out there that is similar to it?
Thanks!!!
Brian
The control is not a public control and can not be created outside of the control. You would need to write your own.
-Daniel
ReportViewer's checked dropdown list control?
displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control
(i.e. I have the ShowParameterPrompts property on my Report Viewer control
set to False).
I would like to use the Checked Dropdown List control that allows you to
check off each item individually or to check the (Select All) option for my
multi-valued parameters.
Is there a way I can create an instance of this checked dropdown control or
is there another component out there that is similar to it?
Thanks!!!
BrianMy understanding is that the only extensibility area the Report Viewer
supports is hiding the menus you don't need and writing your own. So, the
short answer is to your question is no. To re-confirm, please post your
question to
http://forums.microsoft.com/msdn/showforum.aspx?forumid=75&siteid=1. This
newsgroup is monitored by Rajeev Karunakaran who is the Program Manager of
the Report Viewer controls.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"brianpmccullough" <bmccullough11@.comcast.net> wrote in message
news:72596A04-35ED-434A-B30C-186F3ABB7CAA@.microsoft.com...
>I would like to create my own parameter area for my reports which are
> displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer
> control
> (i.e. I have the ShowParameterPrompts property on my Report Viewer control
> set to False).
> I would like to use the Checked Dropdown List control that allows you to
> check off each item individually or to check the (Select All) option for
> my
> multi-valued parameters.
> Is there a way I can create an instance of this checked dropdown control
> or
> is there another component out there that is similar to it?
> Thanks!!!
> Brian
>|||Teo,
Thanks for your help. I have posted to the Report Viewer's newsgroup, but
no response...
Any other ways I might be able to see if this "checked dropdown" control is
available for use in an asp.net page?
-Brian
"Teo Lachev [MVP]" wrote:
> My understanding is that the only extensibility area the Report Viewer
> supports is hiding the menus you don't need and writing your own. So, the
> short answer is to your question is no. To re-confirm, please post your
> question to
> http://forums.microsoft.com/msdn/showforum.aspx?forumid=75&siteid=1. This
> newsgroup is monitored by Rajeev Karunakaran who is the Program Manager of
> the Report Viewer controls.
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "brianpmccullough" <bmccullough11@.comcast.net> wrote in message
> news:72596A04-35ED-434A-B30C-186F3ABB7CAA@.microsoft.com...
> >I would like to create my own parameter area for my reports which are
> > displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer
> > control
> > (i.e. I have the ShowParameterPrompts property on my Report Viewer control
> > set to False).
> >
> > I would like to use the Checked Dropdown List control that allows you to
> > check off each item individually or to check the (Select All) option for
> > my
> > multi-valued parameters.
> >
> > Is there a way I can create an instance of this checked dropdown control
> > or
> > is there another component out there that is similar to it?
> >
> > Thanks!!!
> >
> > Brian
> >
>
>
ReportViewer: Show toggle for specific item in a list??
Wondering if anyone has any ideas about this:
I have ReportViewer on an ASP page with a report that has a list. The
list shows me rows and I want to be able to toggle just one of the
items in the list based on the type of item it is. Currently I can
only show the toggle icon for all the list items, like this:
+Item1
+Item2
+Item3
But I want the report to show only this:
Item1
+Item2
Item3
I've tried all manner of IIF formulas but none work. Is this even
possible?
ThanksPlease, does anyone have any experience with this?
On Mar 13, 6:11 pm, phrankbo...@.hotmail.com wrote:
> Hello,
> Wondering if anyone has any ideas about this:
> I have ReportViewer on an ASP page with a report that has a list. The
> list shows me rows and I want to be able to toggle just one of the
> items in the list based on the type of item it is. Currently I can
> only show the toggle icon for all the list items, like this:
> +Item1
> +Item2
> +Item3
> But I want the report to show only this:
> Item1
> +Item2
> Item3
> I've tried all manner of IIF formulas but none work. Is this even
> possible?
> Thanks
ReportViewer: creating PDF on the fly
Hi all,
I'm writing a offer web page using ReportViewer control.
This offer page will be shown in PDF format.
I understood that the ReportViewer control can't work without any DataSource, but for my needs I use report parameters and not DataSet (or somesimilar object). So, I defined the unreal DataSet just for deceive the ReportViewer (I don't know if this solution is wise, but probably it's what I able).
<rsweb:ReportViewer runat="server" ID="ReportViewer1" Font-Names="Verdana" Font-Size="8pt" Height="400px" ShowToolBar="False" Width="685px"> <LocalReport ReportPath="Offer.rdlc" > <DataSources> <rsweb:ReportDataSource DataSourceId="objectDataSource" Name="DataSet1" /> </DataSources> </LocalReport></rsweb:ReportViewer><asp:ObjectDataSource runat="server" ID="objectDataSource" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DataSet1TableAdapters.MyTableAdapter"></asp:ObjectDataSource> So far so good. When I activate the offer page, it shown properly, but when I add the following code for create the PFD document from the page, I get an error:A data source instance has not been supplied for the data source "DataSet1"
protected void Page_Load(object sender, EventArgs e){ Warning[] warnings;string[] streamids;string mimeType;string encoding;string extension;byte[] myBytes =this.ReportViewer1.LocalReport.Render("PDF",null,out mimeType,out encoding,out extension,out streamids,out warnings); Response.Buffer =true; Response.Clear(); Response.ContentType = mimeType; Response.BinaryWrite(myBytes); Response.Flush(); Response.End();}
Please help!
Thanks in advance!
Hi,
Take a look over here :
http://blogs.msdn.com/bimusings/archive/2005/07/01/434659.aspx
HTH,
Suprotim Agarwal
--
http://www.dotnetcurry.com
--
Hi Suprotim Agarwal,
Thank you for the quick response.
I already saw this short article, but it not exactly answers to my case - the error appears only when I create a PDF document from my predefined ReportViewer. If I delete an aforementioned code, the Offer.aspx page work properly.
|||
Hi,
Based on the code you provided, you are going to render the report in the code behind, right?
I think you should declare and add the report datasource explicitly in your code-behind file before you are invoking the render method, see the following code snippet:
protected void Page_Load(object sender, EventArgs e)
{
this.ReportViewer1.ProcessingMode = ProcessingMode.Local;
this.ReportViewer1.LocalReport.ReportPath =
@."c:\Reports\Report1.rdl";
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Sales", LoadSalesData())); declare and add the datasource explicitly.
}
protected void Button1_Click(object sender, EventArgs e)
{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
byte[] bytes = ReportViewer1.LocalReport.Render(
"Excel", null, out mimeType, out encoding,
out extension,
out streamids, out warnings);
FileStream fs = new FileStream(@."c:\output.xls",
FileMode.Create);
fs.Write(bytes, 0, bytes.Length);
fs.Close();
Label1.Text = "Report exported to output.xls";
}
}
Thanks.
The problem solved when I moved a code that creates a PDF document from Page_Load to Page_SaveStateComplete event.
Thanks to all of you!
ReportViewer.SizeToReportContent - has anyone got an example?
The report I am showing has drillthroughs to multiple other reports,
some of which fit on the screen and some are wider than the screen.
I would like to dynamically size the control so it matches the
interactive size of the report currently being displayed by drill
through. That way scroll bars would appear on the outside of the web
browser only when required.
I cant figure out how to do this.
I have tried setting ReportViewer1.SizeToReportContent = true; in both
ReportViewer_Drillthrough and Page_Load events but to no avail.
Has anyone got an example of this working?
Thanks,
Renato
To be clear this is what I have in the aspx:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
Width="98%" Height="600px"
OnDrillthrough = "ReportViewer1_Drillthrough">
</rsweb:ReportViewer>
In the cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
ReportViewer1.PromptAreaCollapsed = true;
ReportViewer1.ShowBackButton = true;
ReportViewer1.HyperlinkTarget = "_self";
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;
Systm.Uri oReportServer = new
System.Uri("http://wrypgpdbs04/ReportServer/");
ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
ReportViewer1.ServerReport.ReportPath = "/PGP/Sales/DailySales/DailySalesNavigation";
ReportViewer1.SizeToReportContent = true;
}
}
protected void ReportViewer1_Drillthrough(object sender,
Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
{
ReportViewer1.SizeToReportContent = true;
}Hi, RBot
I would recommend removing the width and height property from the
declaration of the ReportViewer control, to see if that CSS style for
the control is not overriding the SizeToReportContent property. It
would seem that even though you set the property to true, you're
constraining the control in the browser by using those 2 style tags.
Hope that works.
Thiago
On Nov 22, 9:38 pm, "RBot" <renato_b...@.iprimus.com.au> wrote:
> I have an aspx 2.0 page using the ReportViewer control on SRS2005.
> The report I am showing has drillthroughs to multiple other reports,
> some of which fit on the screen and some are wider than the screen.
> I would like to dynamically size the control so it matches the
> interactive size of the report currently being displayed by drill
> through. That way scroll bars would appear on the outside of the web
> browser only when required.
> I cant figure out how to do this.
> I have tried setting ReportViewer1.SizeToReportContent = true; in both
> ReportViewer_Drillthrough and Page_Load events but to no avail.
> Has anyone got an example of this working?
> Thanks,
> Renato
> To be clear this is what I have in the aspx:
> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
> Width="98%" Height="600px"
> OnDrillthrough = "ReportViewer1_Drillthrough">
> </rsweb:ReportViewer>
> In the cs:
> protected void Page_Load(object sender, EventArgs e)
> {
> if (!Page.IsPostBack)
> {
> ReportViewer1.PromptAreaCollapsed = true;
> ReportViewer1.ShowBackButton = true;
> ReportViewer1.HyperlinkTarget = "_self";
> ReportViewer1.ProcessingMode => Microsoft.Reporting.WebForms.ProcessingMode.Remote;
> Systm.Uri oReportServer = new
> System.Uri("http://wrypgpdbs04/ReportServer/");
> ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
> ReportViewer1.ServerReport.ReportPath => "/PGP/Sales/DailySales/DailySalesNavigation";
> ReportViewer1.SizeToReportContent = true;
> }
> }protected void ReportViewer1_Drillthrough(object sender,
> Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
> {
> ReportViewer1.SizeToReportContent = true;
>
> }- Hide quoted text -- Show quoted text -|||Thanks Thiago,
I tried this but still get the scrollbars around a iframe-like area.
The report viewer now seems to inherit the width from its containing
div element, which in turn gets it from a shared stylesheet. I can set
the width of the div, but this is static, not responsive to the size of
the report.
I dont know what style to use to reset the width back to "vanilla".
tafs7 wrote:
> Hi, RBot
> I would recommend removing the width and height property from the
> declaration of the ReportViewer control, to see if that CSS style for
> the control is not overriding the SizeToReportContent property. It
> would seem that even though you set the property to true, you're
> constraining the control in the browser by using those 2 style tags.
> Hope that works.
> Thiago
>
> On Nov 22, 9:38 pm, "RBot" <renato_b...@.iprimus.com.au> wrote:
> > I have an aspx 2.0 page using the ReportViewer control on SRS2005.
> >
> > The report I am showing has drillthroughs to multiple other reports,
> > some of which fit on the screen and some are wider than the screen.
> > I would like to dynamically size the control so it matches the
> > interactive size of the report currently being displayed by drill
> > through. That way scroll bars would appear on the outside of the web
> > browser only when required.
> > I cant figure out how to do this.
> >
> > I have tried setting ReportViewer1.SizeToReportContent = true; in both
> > ReportViewer_Drillthrough and Page_Load events but to no avail.
> >
> > Has anyone got an example of this working?
> >
> > Thanks,
> > Renato
> >
> > To be clear this is what I have in the aspx:
> > <rsweb:ReportViewer ID="ReportViewer1" runat="server" Enabled="true"
> > Width="98%" Height="600px"
> > OnDrillthrough = "ReportViewer1_Drillthrough">
> > </rsweb:ReportViewer>
> > In the cs:
> > protected void Page_Load(object sender, EventArgs e)
> > {
> > if (!Page.IsPostBack)
> > {
> > ReportViewer1.PromptAreaCollapsed = true;
> > ReportViewer1.ShowBackButton = true;
> > ReportViewer1.HyperlinkTarget = "_self";
> > ReportViewer1.ProcessingMode => > Microsoft.Reporting.WebForms.ProcessingMode.Remote;
> > Systm.Uri oReportServer = new
> > System.Uri("http://wrypgpdbs04/ReportServer/");
> > ReportViewer1.ServerReport.ReportServerUrl = oReportServer;
> > ReportViewer1.ServerReport.ReportPath => > "/PGP/Sales/DailySales/DailySalesNavigation";
> > ReportViewer1.SizeToReportContent = true;
> > }
> >
> > }protected void ReportViewer1_Drillthrough(object sender,
> > Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
> > {
> > ReportViewer1.SizeToReportContent = true;
> >
> >
> >
> > }- Hide quoted text -- Show quoted text -|||Just for the record I have sorted my issues with the ReportViewer web
control.
In the report definitions I need to ensure that the Report dimensions
are larger than the Page dimensions plus margins.
Once this is done the scrollbars dont appear for the ReportViewer
control.
Strangely this is never a problem when viewing reports directly on the
report server via http.
Renato
ReportViewer's checked dropdown list control?
I would like to create my own parameter area for my reports which are displayed in an ASP.NET web page with the ASP.NET 2005 ReportViewer control (i.e. I have the ShowParameterPrompts property on my Report Viewer control set to False).
I would like to use the Checked Dropdown List control that allows you to check off each item individually or to check the (Select All) option for my multi-valued parameters.
Is there a way I can create an instance of this checked dropdown control or is there another component out there that is similar to it?
Thanks!!!
Brian
The control is not a public control and can not be created outside of the control. You would need to write your own.
-Daniel