Friday, March 23, 2012

Reset Page Numbering Total

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 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
> >
> >

No comments:

Post a Comment