Does anyone know of a way to reset page numbering when the group changes?
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
Showing posts with label numbering. Show all posts
Showing posts with label numbering. Show all posts
Wednesday, March 28, 2012
Monday, March 26, 2012
Reseting the unique id if a table.
I'm building a web site. there is a database.
I've set a primary key and unique of a field.also I set it to auto numbering.
Everytime I insert a record , that field will increase 1 (type bigint , start from 1).
After lots time of inserting record , the id going to be larger number.. I wondering how can I reset that to zero?
Run query Truncate Table YuorTableName
Reset Sequential Numbering
I have a table that is updated on a regular interval. I need to set an
overall ID that increments by 1, such as 0001, 0002, etc. I need a second ID
that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
which also resets to 20001 for each new update interval.
ThanksFor a heavy usage system, this could be costly.
Anyway, you could create an update trigger and increment the columns as
desired.
e.g.
create trigger _u on tb
for update
as
update tb
set colx=right(10001+cast(colx as int),4)
from tb,inserted i
where tb.pk=i.pk
go
-oj
"HollyylloH" <HollyylloH@.discussions.microsoft.com> wrote in message
news:AE05B6DD-30F4-45A3-94D3-AE1AD09BC31F@.microsoft.com...
>I have a table that is updated on a regular interval. I need to set an
> overall ID that increments by 1, such as 0001, 0002, etc. I need a second
> ID
> that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
> which also resets to 20001 for each new update interval.
> Thankssql
overall ID that increments by 1, such as 0001, 0002, etc. I need a second ID
that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
which also resets to 20001 for each new update interval.
ThanksFor a heavy usage system, this could be costly.
Anyway, you could create an update trigger and increment the columns as
desired.
e.g.
create trigger _u on tb
for update
as
update tb
set colx=right(10001+cast(colx as int),4)
from tb,inserted i
where tb.pk=i.pk
go
-oj
"HollyylloH" <HollyylloH@.discussions.microsoft.com> wrote in message
news:AE05B6DD-30F4-45A3-94D3-AE1AD09BC31F@.microsoft.com...
>I have a table that is updated on a regular interval. I need to set an
> overall ID that increments by 1, such as 0001, 0002, etc. I need a second
> ID
> that does similarly, incrementing by 1 (such as 20001, 20002, 20003), but
> which also resets to 20001 for each new update interval.
> Thankssql
Friday, March 23, 2012
Reset PageNumber On Group Change
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.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.
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
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
> >
> >
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
> >
> >
Wednesday, March 21, 2012
Reset Automatic Numbering
Does anyone know how to reset the autmatic numbering in SQL?DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
Thanks ,
P.C Sekhar.
"Comm Port not Working" <CommPortnotWorking@.discussions.microsoft.com> wrote
in message news:79520BCF-F4A6-4038-B817-551F70EB269E@.microsoft.com...
> Does anyone know how to reset the autmatic numbering in SQL?|||That worked ...Thank you!!!
"P.C Sekhar" wrote:
> DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
> Thanks ,
> P.C Sekhar.
> "Comm Port not Working" <CommPortnotWorking@.discussions.microsoft.com> wro
te
> in message news:79520BCF-F4A6-4038-B817-551F70EB269E@.microsoft.com...
>
>sql
Thanks ,
P.C Sekhar.
"Comm Port not Working" <CommPortnotWorking@.discussions.microsoft.com> wrote
in message news:79520BCF-F4A6-4038-B817-551F70EB269E@.microsoft.com...
> Does anyone know how to reset the autmatic numbering in SQL?|||That worked ...Thank you!!!
"P.C Sekhar" wrote:
> DBCC CHECKIDENT ('table_name', RESEED, new_reseed_value)
> Thanks ,
> P.C Sekhar.
> "Comm Port not Working" <CommPortnotWorking@.discussions.microsoft.com> wro
te
> in message news:79520BCF-F4A6-4038-B817-551F70EB269E@.microsoft.com...
>
>sql
Subscribe to:
Posts (Atom)