Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Inserting report details to a table Post Reply Post New Topic
Page  of 2 Next >>
Author Message
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet 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 IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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 IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet 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 IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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 IP Logged
kostya1122
Senior Member
Senior Member
Avatar

Joined: 13 Jun 2011
Online Status: Offline
Posts: 475
Quote kostya1122 Replybullet 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 IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet 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 IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet Posted: 28 Jan 2014 at 12:12am
Thanks for getting back.
 
Please see note above.
IP IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet 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 IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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 IP Logged
Central
Groupie
Groupie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 56
Quote Central Replybullet 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 IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.030 seconds.