Mark Tabor

Mark Tabor

  • 584
  • 2k
  • 464.7k

Crystal Report Charts from one stored Procedure

May 28 2016 8:26 AM
I want to create a dashboard like page and my Dashboard page will contain 4 charts I just have a single table from which i want to get results I wrote a stored procedure with Multiple Select statement just like below 
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[GetResultOfAllPUsForDahboard]
AS
BEGIN
SELECT SUM(DI.TFA+DI.TFM+DI.TFW+DI.TFB+DI.TFG) AS TARGET ,SUM(DI.TFAAnser+DI.TFBAnswer+DI.TFWAnswer+DI.TFMAnswer+DI.TFGAnswer)AS ACHIEVED,Quarter from DynamicIndicatorsTargetsForPu as DI
group by Quarter
SELECT SUM(DI.TFA+DI.TFM+DI.TFW+DI.TFB+DI.TFG) AS TARGET ,D.DistrictName ,SUM(DI.TFAAnser+DI.TFBAnswer+DI.TFWAnswer+DI.TFMAnswer+DI.TFGAnswer)AS ACHIEVED from DynamicIndicatorsTargetsForPu as DI
INNER JOIN Districts D ON D.DistrictId=DI.District
group by DistrictName
SELECT SUM(DI.TFA+DI.TFM+DI.TFW+DI.TFB+DI.TFG) AS TARGET ,Y.Year_Name ,SUM(DI.TFAAnser+DI.TFBAnswer+DI.TFWAnswer+DI.TFMAnswer+DI.TFGAnswer)AS ACHIEVED from DynamicIndicatorsTargetsForPu as DI
INNER JOIN Year Y ON y.Year_ID=DI.Year
group by y.Year_Name
END
 
 
Each select statement is group by its own column but when i want to use that stored procedure i just gets the columns of first select statement how to fix that , any other idea how to create 4 charts on same crystal report  
 

Answers (1)