Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL STORED PROCEDURE?

Status
Not open for further replies.

konad

Programmer
Jan 5, 2001
43
0
0
US
I have a crystal report with fields and such all over the place and my data is all good with the linking and such for my fields, however i have 2 charts on the report, that need data from the same tables however they need there own SQL statement to pull it out and get the data they need, I have read about using stored procedures and all but there are no examples that I have run across thus far as how to use a stored procedure SQL statement, and then let my charts use that statement for there data. Can someone help or is this too deep?
 
If you need a separate result set, whether it is a stored procedure or a set of linked tables, you will need a subreport. With a subreport you simply write the chart as a separate report and insert it into the main report (in the report header or footer most likely). Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
hi.,
I know that Ken always suggests brilliant solutions and is really genious in Crystal but i would like to know Ken "Cant we just insert the same table Twice in a report ( ie having an alias name for the same table and thus we can have different SQL statement to pull from the two tables( which are actually has same data and we can pull data with different SQL query) instead of going to Subreports."
As far as i understood from Konad's question., he just need data from same table but with different SQL query and if i am right, then he can just insert the same table TWICE by giving some alias name and after proper linking he can jus query the other table as he likes.
Can he do that ?
 
Brilliant? Genius? What a way to start the week.

Yes, you can add a table a second and third time and Crystal will prompt you for an alias each time. You can then link them and treat them as if they were separate tables.

However I interpreted the question differently. When he says:

"need data from the same tables however they need there own SQL statement to pull it out and get the data they need"

I assumed that "their own SQL statement" meant that they need an UNRELATED SQL statement. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
yes i created the separate sub reports however the only thing i need is the charts, and using the subreports to just use the charts i loose alot of visual resolution it seems, the problem i originally had with using the charts and the same sql statement is when i used a formula to say

if ({tblCallStatus.StatusType} = "B" OR {tblCallStatus.StatusType} = "C") then
{tblCallStatus.StatusCode} & " " & {tblCallStatus.StatusDescription}

i would get my data back however on my statuscode there i have 2 "C"'s, each with its own desriptive in a diffrent statustype, one is for StatusType "U" that i use on my 2nd chart, and one is for statustype"C" that i used with my 1st chart, and with the current sql statement it would see both "C"'s from the statuscode, put a ghost line in my charts. so there fore i needed to use a separate sql statement to segregate my data before it got to my formula so that it would not give me the ghost :)
 
Yes, you need separate result tables for each chart. Otherwise the linked records will get inflated

Using a subreport's chart should not affect the visual resolution. the chart should appear the same as it does when the subreport is freestanding. Make sure the subreport object is large enough to display the entire chart in the main report, and that the chart object in the subreport is also large enought to give good resolution. Ken Hamady
Crystal Reports Training and a
Quick Reference Guide to VB/Crystal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top