?
Solved

Crystal Reports Question

Posted on 2011-04-25
2
Medium Priority
?
296 Views
Last Modified: 2012-05-11
I am working on a report that uses SQL Server 2005 stored procedure. One of the columns in the stored proc is string 30 . But when this field comes in Crystal Reports, it is coming over as String 1. I am baffled and donot know where and how it is getting changed! Your help will be much appreciated. Here is the SQL Code. The field is TaskStatusCode.

ALTER PROCEDURE [dbo].[hsp_eMARDowntime_DailyTasks](  

@ClientGUIDVar varchar(16),
@OrderGUIDVar varchar(16),
@OrderTaskGUIDVar varchar(16),
@DateOffset int
)  
AS  

SET NOCOUNT ON  
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

DECLARE
@StartDate datetime,
@StopDate datetime,
@CurrentDate datetime

DECLARE
@ClientGUID numeric(16,0),
@OrderGUID numeric(16,0),
@OrderTaskGUID numeric(16,0)

SELECT
@ClientGUID = cast(@ClientGUIDVar as numeric(16,0)),
@OrderGUID = cast(@OrderGUIDVar as numeric(16,0)),
@OrderTaskGUID = cast(@OrderTaskGUIDVar as numeric(16,0))


SELECT @CurrentDate = getdate()
SELECT @StartDate = dateadd(dd, @DateOffset, CAST(CONVERT(varchar(10), @CurrentDate, 101) as DateTime))
SELECT @StopDate = dateadd(ms, -3, dateadd(dd, 1, @StartDate))

SELECT
CASE       WHEN oto.TaskStatusCode = 'Performed' THEN PerformedFromDtm
      ELSE ScheduledDtm -- Overdue, Pending,
END as OccurrenceDtm,
oto.TaskStatusCode,
ts.code,
@StartDate as StartDate
into #x
FROM
CV3OrderTaskOccurrence oto,
CV3TaskStatus ts
WHERE
oto.TaskStatusCode = ts.code
AND oto.ClientGUID = @ClientGUID
AND oto.OrderGUID = @OrderGUID
AND oto.OrderTaskGUID  = @OrderTaskGUID
AND oto.TaskStatusCode = ts.code
AND ScheduledDtm between @StartDate and @StopDate

IF @@RowCount = 0  
BEGIN
SELECT
cast(null as datetime) as OccurrenceDtm,
'' as TaskStatusCode,
'' as TaskCode,
@StartDate as StartDate
END
ELSE
SELECT * from #x






0
Comment
Question by:rustypoot
2 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 35462135
I think the issue is Crystal uses the last SELECT statement it sees to determine th efields.  Since you have TaskStatusCode defined as "" it assumes a string 1

mlmcc
0
 

Author Closing Comment

by:rustypoot
ID: 35462368
Thanks so much!!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question