I'm new at Crystal Reports and still learning so I'm wondering how I should do this. I have the following stored procedure:
CREATE PROCEDURE GetSurveyAnswerDetail
(@Question VARCHAR(255) = NULL, @AllowReportFlag CHAR(1) = NULL)
AS
SET NOCOUNT ON
DECLARE @rc INT
SET @rc = 1
IF (@Question IS NULL OR DATALENGTH(@Question) = 0
OR @AllowReportFlag IS NULL OR DATALENGTH(@AllowReportFlag) = 0)
RAISERROR('GetSurveyAnswerDetail is missing parameters.', 16, 1)
ELSE
BEGIN
DECLARE @AllowReport VARCHAR(100)
IF (@AllowReportFlag = 'N')
SET @AllowReport = ' AllowReport = ''Y'' AND '
ELSE
SET @AllowReport = ''
DECLARE @SQLStatement VARCHAR(5000)
SET @SQLStatement = 'SELECT COUNT(' + @Question + ') FROM tblSurveyAnswer WHERE ' + @AllowReport + @Question + ' != '''' GROUP BY ' + @Question + ' ORDER BY ' + @Question + ' DESC'
EXEC (@SQLStatement)
IF @@ERROR <> 0
RAISERROR('GetSurveyAnswerDetail has failed. Question may not exist.', 16, 1)
ELSE
SET @rc = 0
END
RETURN @rc
GO
This returns a list of numbers. What I'd like to do is create a pie chart from these numbers in Crystal Reports. I know you can set your data source from a stored procedure but when I do this, there are no fields I can choose. I'm probably going about this the wrong way so I'd appreciate any comments.