Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Data Connectivity
Message Icon Topic: making a working link between 2 excel sheets Post Reply Post New Topic
<< Prev Page  of 2
Author Message
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 Aug 2009 at 6:10am
I don't know about the excel as a datasource, as mine are all SQL, but if the initial data is already coming from a stored proc, why not make a simple stored proc that unions them, or the very least populates a temp table.  Something like
 
create table #tOpen(
 weekStart DATETIME,
 tickets INT,
 open BIT)
 
INSERT #tOpen
SELECT weekStart, COUNT(tickets), 1 FROM...
WHERE openTicketCriteria = true
 
INSERT #tOpen
SELECT weekStart, COUNT(tickets), 0 FROM...
WHERE openTicketCriteria = false
 
Just a thought
 
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 18 Aug 2009 at 7:04am

Thanks Lockwelle, that was where I was headed too.

JennyLynn, if the data is too large to do this with you can use a stored procedure with parameters to limit the scope of the data at selection time.

 

IP IP Logged
JennyLynn
Newbie
Newbie
Avatar

Joined: 07 Jul 2009
Location: United States
Online Status: Offline
Posts: 12
Quote JennyLynn Replybullet Posted: 18 Aug 2009 at 8:03am
Just got access to the DB server today. Never played with stored procedures before but they seem pretty straight forward. I'll let you know my results! Thanks lockwell & DBlank!!! Smile
~~~~Jenny Lynn
IP IP Logged
JennyLynn
Newbie
Newbie
Avatar

Joined: 07 Jul 2009
Location: United States
Online Status: Offline
Posts: 12
Quote JennyLynn Replybullet Posted: 19 Aug 2009 at 2:27pm
SUCCESS!!!
Thank you so much for your help DBlank and lockwell! Tongue

I ended up creating 3 stored procs, one that selected all the ticket open times and grouped them by assignment then date, one that selected all the closed ticket times and grouped them the same way, then the third stored proc essentially did lockwell's suggestion and put them both into the same table. After that when back in crystal I could group them and it drew the information back together (or close enough to it).

The sad part is I still need to output the resulting report data to excel if I want to graph it because the backlog data (opened - closed) is done by a running total and Crystal Reports X can't graph on that! Angry

For anyone reading who wants the full solution I'll paste it below (because I hate when I'm reading a post and the final solution isn't posted!)


Stored Proc #1:
CREATE PROCEDURE dbo.usp_interactions_opened_by AS

SELECT DatePart(month, PROBSUMMARYM1.OPEN_TIME) as MONTH, DatePart(day, PROBSUMMARYM1.OPEN_TIME) as DAY, DatePart(year, PROBSUMMARYM1.OPEN_TIME) as YEAR, PROBSUMMARYM1.ASSIGNMENT, COUNT(PROBSUMMARYM1.ASSIGNMENT) as OPENED, NULL AS CLOSED
FROM   database.dbo.PROBSUMMARYM1 PROBSUMMARYM1
GROUP BY PROBSUMMARYM1.ASSIGNMENT, DatePart(year, PROBSUMMARYM1.OPEN_TIME), DatePart(month, PROBSUMMARYM1.OPEN_TIME), DatePart(day, PROBSUMMARYM1.OPEN_TIME)
GO


Stored Proc #2:
CREATE PROCEDURE dbo.usp_interactions_closed_by AS

SELECT DatePart(month, PROBSUMMARYM1.CLOSE_TIME) as MONTH, DatePart(day, PROBSUMMARYM1.CLOSE_TIME) as DAY, DatePart(year, PROBSUMMARYM1.CLOSE_TIME) as YEAR, PROBSUMMARYM1.ASSIGNMENT, NULL AS OPENED, COUNT(PROBSUMMARYM1.ASSIGNMENT) as CLOSED
FROM   database.dbo.PROBSUMMARYM1 PROBSUMMARYM1
WHERE PROBSUMMARYM1.CLOSE_TIME != null
GROUP BY PROBSUMMARYM1.ASSIGNMENT, DatePart(year, PROBSUMMARYM1.CLOSE_TIME), DatePart(month, PROBSUMMARYM1.CLOSE_TIME),  DatePart(day, PROBSUMMARYM1.CLOSE_TIME)
GO


Stored Proc #3:
CREATE PROCEDURE dbo.usp_together AS

create table #tOpen1(
 MONTH INT,
 DAY INT,
 YEAR INT,
 ASSIGNMENT VARCHAR(130),
 OPENED INT,
 CLOSED INT)

insert into #tOpen1
exec usp_interactions_opened_by

insert into #tOpen1
exec usp_interactions_closed_by

select * from #tOpen1
GO


Thanks again to both of you! Big%20smile


Edited by JennyLynn - 19 Aug 2009 at 2:31pm
~~~~Jenny Lynn
IP IP Logged
<< Prev Page  of 2
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.031 seconds.