Author |
Message |
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Topic: Inserting report details to a table Posted: 27 Jan 2014 at 1:43am |
I am looking to insert the report details to a table in SQL Server? Mainly want to capture what page the record is on the report plus a couple of other things. Can this be done and if so how?
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 27 Jan 2014 at 4:47am |
not really. CR by it's nature does not write to the database, it just reads. If you would like to write to the database, you could use a stored procedure, but as far as what page a user if viewing, I don't know of a way to track that, not in the database.
|
IP Logged |
|
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Posted: 27 Jan 2014 at 4:53am |
Thanks for getting back. Is that a stored procedure within Crystal Reports and if so, how is this created or is it a view within the database. I am trying to get a record that has the page number on each detail within the report.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 27 Jan 2014 at 10:45am |
you could write a stored procedure and have Crystal use it to retrieve data from the database. While it is executing, it could update/insert into another table.
As for the page number, I'll be honest, I don't know about that, as depending on settings in report, CR will paginate in such a way that I am not sure that we can assign a value to what page a detail will be printed on.
As a caveat to the above, if more than 1 person is running the report at the same time, whose values are there could be dicey...it's all a matter of how you save the data and how you use it.
Again, knowing what page something is on, may be hit or
miss.
|
IP Logged |
|
kostya1122
Senior Member
Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
|
Posted: 27 Jan 2014 at 12:08pm |
for this to make sense you have to have specific order by
you could create a counter table in sql like
select primery_key_field,
ROW_NUMBER ( )
OVER ( order by [somefield] )/46 + 1 as page_no
into counter_table
from table
assuming you have 46 records per page
Edited by kostya1122 - 27 Jan 2014 at 12:09pm
|
IP Logged |
|
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Posted: 28 Jan 2014 at 12:11am |
Thanks for getting back. The reason I want the page number is so I can do a table of content on a different report. If I have the page number on what page the record is on then I can have a from and to page for a record. This I can do in the background. If I can set up a table and able to insert the page number as I run the report I can hopefully acheive this. I hope this makes sense as at the moment I think I am getting too confused and maybe there is a simply way of acheiving this.
|
IP Logged |
|
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Posted: 28 Jan 2014 at 12:12am |
Thanks for getting back. Please see note above.
|
IP Logged |
|
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Posted: 28 Jan 2014 at 3:21am |
I have read that some folk have created a temp table, inserts data into the temp table then selects the data from the temp table via Crystal reports. If this can be done then it could solve my problem. Next question....how is this done if it can be done?
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
|
Posted: 28 Jan 2014 at 4:48am |
subreport...it can have a different data source than the main report...though the temp table would be either a global temp table, or an actual table that is used just for this report.
|
IP Logged |
|
Central
Groupie
Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
|
Posted: 28 Jan 2014 at 4:57am |
This may sound rather daft of me but can I create a temp table, input the details from the main report along with the page number. If so, how is this done. Sorry about this but I am a novice when it comes to Crystal Reports.
|
IP Logged |
|
|