 |
| SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 22nd, 2007, 10:27 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Crystal reports
How can I repeat Top 10 Selected records 3 times on the first page in
Crystal X.
Thank you,
Violetta
|
|

October 22nd, 2007, 12:57 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
hi there.. you can repeat the same field for as many as you want.. it will print the same data for every record.. (if you put 2 XX fields, it will print the value of XX twice...)
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
|
|

October 22nd, 2007, 03:11 PM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,
Thank you very much for your reply. I tried to implement your suggestion : Select Customer ID, Customer ID,CustomerName, CustomerName etc, but it still generates only 10 Top Selected without repeating.
Did I interpret you correctly?
Thank you,
Violetta
|
|

October 22nd, 2007, 03:52 PM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,
Actually, I was able to repeat two records as you suggested, but I don't want to locate together the two identical records. It needs to be repeated after printing the first 10 extract.
I guess it must be in detail section.
Now two records go one after other.
Do you know any idea?
Thank you,
V
|
|

October 22nd, 2007, 08:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
mmm.. I don't see your point in doing that.. maybe you can post a little example of what you need??? Why repeat the records when you reach ten??
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
|
|

October 23rd, 2007, 02:55 PM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,
The report generates Top 10 Sales people with their Names, Location and Amounts they sold for a period of time - Date parameter.
It need to print 3 times on the first page with company Logo, then cut on 3 pieces (to save a paper) and then distribute to sales people with their paycheck.
I am using SQL to create a report.
I was trying to insert 3 times Select with all conditional statements,
but it did not give me good result.
I used your suggestion and it repeats the same 3 person one after other in detail section.
|
|

October 23rd, 2007, 08:28 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
ah... now I see what you need better.. my solutions does what you first ask, print the same records 3 times.. in the same section ;)
the best solution I can find for you is do the query 3 times using a union between every query.. something like
select top 10 a,b from t
union
select top 10 a,b from t
union
select top 10 a,b from t
this will give you the same data 3 times.. only use 1 field in the report.. let's see it's this fit you better...
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
|
|

October 24th, 2007, 07:50 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,Thank you, I will try your idea - I have union already in my logic - let see how it works together.
Violetta
|
|

October 25th, 2007, 10:25 AM
|
|
Authorized User
|
|
Join Date: Oct 2007
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Gonzalo,
Union selection in Crystal did not give the right result.
I created a procedure with @counter and logic if @counter<3 begin select end. Then I was going to use this procedure in Crystal.
What do you think?
I don't understand why 3 selection work in Query Analyzer and show 3 times, but not in Crystal.
Maybe I need to insert selection in 3 different tables and then select from 3 tables in Crystal?
I need to try.
Maybe something can be done with printing functions like whileprintingrecord?
Thank you,
Violetta
|
|

October 25th, 2007, 11:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
|
|
There should never be a reason to retrieve the same data multiple times from a database just because you need to display it more than once on some report.
Retrieve the data once, then manipulate it on the client to display it as many times as you need. I think yours is a reporting problem and not a database query problem.
How about creating a subreport that displays the data that you want, then adding the subreport 3 times (or as many times as you need it)? Each subreport would occupy it's own detail section on the page where you want it displayed.
It could probably be done without subreports at all by simply duplicating the data to be displayed in as many detail sections as you need.
This sounds more like a problem with your use of Crystal than it does an SQL problem, so maybe you should try the Crystal forum??
Jeff Mason
[email protected]
|
|
 |